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






























2
3
4
5
6
7
8
































2016-10-01 Rolf Ade  <rolf@pointsman.de>

        Updated to expat 2.2.0.

2015-09-11 Rolf Ade  <rolf@pointsman.de>

        Added options -xmlDeclaration and -encString to the asXML
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
2017-08-21 Ashok Nadkarni

        Windows build system (VC and mingw) modernised.

2017-08-17 Rolf Ade  <rolf@pointsman.de>

        New feature "creating real FQ nodes with *fromScript methods",
        by adding option -namespace to [dom createNodeCmd].

2017-08-14 Rolf Ade  <rolf@pointsman.de>

        Updated TEA.

2017-07-29 Rolf Ade  <rolf@pointsman.de>

        Removed hacky check on [load] time if the tclsh and tDOM are
        build with incompatible TCL_UTF_MAX (because it did not work
        anymore with recent tcl because of changes in core).

2017-07-28 Rolf Ade  <rolf@pointsman.de>

        Added JSON support. New -json option to [dom parse]. New doc
        method asJSON. New node method jsonType. New option -jsonType
        of [dom createNodeCmd]. New option -tagName of [dom
        createNodeCmd]. New option -jsonType to dom method
        createDocumentNode.

2017-04-06 Rolf Ade  <rolf@pointsman.de>

        Added HTM5 parser (new -html5 option to [dom parse]). Requires
        gumbo lib and must be enabled at configure time.
        
2016-10-01 Rolf Ade  <rolf@pointsman.de>

        Updated to expat 2.2.0.

2015-09-11 Rolf Ade  <rolf@pointsman.de>

        Added options -xmlDeclaration and -encString to the asXML

Changes to ChangeLog.

1
2
3
4
5
6
7
8
9
10
11

NOTICE: This file isn't kept up to date anymore. Look at the timeline
of the leading fossil repository
(https://46.163.78.80/cgi-bin/repros/tdom/timeline) or at the backup
repository at https://core.tcl.tk/tdom/timeline for detailed lists of
code changes.

User interface changes/enhancements and other important changes will
still be documented in the CHANGES file.

2012-05-17  Rolf Ade  <rolf@pointsman.de>


|
<







1
2
3

4
5
6
7
8
9
10

NOTICE: This file isn't kept up to date anymore. Look at the timeline
of the leading fossil repository (http://tdom.org) or at the backup

repository at https://core.tcl.tk/tdom/timeline for detailed lists of
code changes.

User interface changes/enhancements and other important changes will
still be documented in the CHANGES file.

2012-05-17  Rolf Ade  <rolf@pointsman.de>

Changes to README.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

22
23
24
25
26

27
28
29
30
31
32
33

34
35
36
37
38
39
40

41
42
43

44
45





46
47
48

49
50




























51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76


77
78
79
80
81
82
83







              tDOM - a XML/DOM/XPath/XSLT implementation for Tcl
                          (Version 0.8.4)

		    Jochen Loewer (loewerj@hotmail.com)
                       Rolf Ade (rolf@pointsman.de)

                       with some contributions by:

                 Zoran Vasiljevic (zv@archiware.com)
                

This directory contains a freely distributable (under the Mozilla Public 
License) thread-safe extension to Tcl/Tk called tDOM.


tDOM contains:

    *  the newest version of Expat, the XML parser from James Clark,
       including namespace and DTD support.


    *  a modified version of Steve Ball's Tclexpat, the Tcl interface to 
       expat, for event-like (SAX-like) XML parsing. The modifications
       are for performance improvements, to make the newest Expat
       features (XML namespace) available and for some additional features.


    *  a (partial) DOM I and II implementation in C for maximum
       performance and minimum memory need following the W3C DOM Core
       Level 1 recommendation using a OO-like syntax.

    *  a very complete, compliant and fast XPath implementation in C
       following the November 99 W3C recommendation.


    *  a fast XSLT implementation in C following the W3C Recommendation
       16 November 1999.
    
    *  a (partial) implementation in C of the XPointer (97) navigational 
       functions.


    *  UTF-8 to 8 bit encoding back conversion functionality to support
       Tcl version < 8.1x


    *  optional DTD validation   






    *  additional convenience methods
 
    *  documentation in TMML, HTML and nroff format































COMPILING/USING tDOM

    Depending on your platform, (unix or win) go to the corresponding
    directory and invoke the configure script:

        ../configure
        make 
        make test
        make install

    Alternatively, you can build the tDOM package in just about any
    directory elsewhere on the fileystem (since TEA-compatible).

    Don't build against Tcl 8.6.2 (or Tcl 8.5.16). This tcl releases
    had bugs in the I/O system, that may bite you while using tDOM.
    
    You might also want to do "../configure --help" to get list of all
    supported options of the configure script. In the "unix" directory
    there is a "CONFIG" file containing some examples on how to invoke
    the "configure" script for some common cases. You can peek
    there. This file also includes a short description of the tDOM
    specific configure options.

    Since tDOM is TEA-compatible you should be able to build it using
    the MinGW build environment for Windows. There is also the MSVC
    nmake file so you can compile the package with Microsoft tools.



    The compile process will build the tDOM shared library suitable for
    loading into the Tcl shell using standard "package require" mechanism.

Have fun! 

- EOF -







|
|
|
|
|
|
|
|
|
|
|
<
<




|
|
>

<
|
|
|
>

<
|
<

|
|
>




|
<

>
|
<

>
|

>
>
>
>
>
|

<
>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|

|
|








|
<
<
<
|
|
|
|
|
|




>
>




<

<
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13


14
15
16
17
18
19
20
21

22
23
24
25
26

27

28
29
30
31
32
33
34
35
36

37
38
39

40
41
42
43
44
45
46
47
48
49
50

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

111

112
113
114
115
116


    tDOM - a XML/DOM/XPath/XSLT/HTML/JSON implementation for Tcl
                          (Version 0.9.0)


This directory contains a freely distributable thread-safe extension
to Tcl/Tk called tDOM.

tDOM was started by Jochen Loewer (loewerj@hotmail.com) and developed
by Jochen and Rolf Ade (rolf@pointsman.de) with contributions by Zoran
Vasiljevic (zv@archiware.com). Since more than a decade it is
maintained and developed by Rolf Ade.




tDOM contains:

    *  for convenience expat 2.2.0, the XML parser originated from
       James Clark, although you're able to link tDOM with other
       expat versions or the library provided by the system.


    *  building a DOM tree from XML in one go implemented in C for
       maximum performance and minimum memory usage, and DOM I and II
       methods to work on such a tree using either a OO-like or a
       handle syntax.


    *  a Tcl interface to expat for event-like (SAX-like) XML parsing.


    *  a complete, compliant and fast XPath implementation in C
       following the November 99 W3C recommendation for navigating and
       data extraction.

    *  a fast XSLT implementation in C following the W3C Recommendation
       16 November 1999.
    
    *  optional DTD validation.


    *  a JSON parser which parses any possible JSON input into a DOM
       tree without losing information.


    *  an efficient and Tcl'ish way to create XML and HTML documents
       and JSON string.

    *  as build option an interface to the gumbo HTML5 parser, which
       also digests almost any other HTML.

    *  an even faster simple XML parser for trusted XML input.

    *  additional convenience methods.
 

    *  and more.


DOCUMENTATION

    The documentation is included into the source distribution in HTML
    and man format. Alternatively, read it online starting at
    http://tdom.org/index.html/doc/tdom-0-9-0/doc/index.html


GETTING THE CODE

    The development repository is hosted at http://tdom.org and is
    mirrored at http://core.tcl.tk/tdom. You are encouraged to use
    trunk.

    If you insist on using an older tDOM with lesser features and
    probably more bugs, you should use the latest release 0.9.0. Get
    the source code release from
    http://tdom.org/downloads/tdom-0.9.0-src.tgz or
    http://tdom.org/downloads/tdom-0.9.0-src.zip

    Windows binaries (32 bit as well as 64 bit) of the 0.9.0 release
    are also available. Get it from
    http://tdom.org/downloads/tdom-0.9-windows-x64.zip and 
    http://tdom.org/downloads/tdom-0.9-windows-x86.zip
    
    The provided windows binaries include (statically linked) the
    HTML5 parser.


COMPILING tDOM

    Depending on your platform (unix/mac or win), go to the
    corresponding directory and invoke the configure script:

        ../configure
        make 
        make test
        make install

    Alternatively, you can build the tDOM package in just about any
    directory elsewhere on the fileystem (since TEA-compatible).
    



    You might also want to do "../configure --help" to get a list of
    all supported options of the configure script. In the "unix"
    directory there is a "CONFIG" file containing some examples on how
    to invoke the "configure" script for some common cases. You can
    peek there. This file also includes a short description of the
    tDOM specific configure options.

    Since tDOM is TEA-compatible you should be able to build it using
    the MinGW build environment for Windows. There is also the MSVC
    nmake file so you can compile the package with Microsoft tools.
    Refer to the README in the win directory for more details about
    building on Windows.

    The compile process will build the tDOM shared library suitable for
    loading into the Tcl shell using standard "package require" mechanism.




REPORTING BUGS

    Please head to http://tdom.org/index.html/ticket and click on "New
    Ticket". Log in as anonymous and report your findings. If you
    prefer to have an individual login write Rolf a mail.

Changes to README.AOL.

1
2
3
4
5
6
7
8
9
10
11


              tDOM - a XML/DOM/XPath/XSLT implementation for Tcl
                          (Version 0.8.3)

		    Jochen Loewer (loewerj@hotmail.com)
                       Rolf Ade (rolf@pointsman.de)

                       with some contributions by:

                 Zoran Vasiljevic (zv@archiware.com)



|







1
2
3
4
5
6
7
8
9
10
11


              tDOM - a XML/DOM/XPath/XSLT implementation for Tcl
                          (Version 0.9.0)

		    Jochen Loewer (loewerj@hotmail.com)
                       Rolf Ade (rolf@pointsman.de)

                       with some contributions by:

                 Zoran Vasiljevic (zv@archiware.com)

Changes to configure.

1
2
3
4
5
6
7
8
9
10
...
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
....
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
....
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
....
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
....
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
....
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
....
5547
5548
5549
5550
5551
5552
5553



5554

5555
5556
5557
5558
5559
5560
5561
....
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
....
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
....
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for tdom 0.8.4.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
................................................................................
subdirs=
MFLAGS=
MAKEFLAGS=

# Identity of this package.
PACKAGE_NAME='tdom'
PACKAGE_TARNAME='tdom'
PACKAGE_VERSION='0.8.4'
PACKAGE_STRING='tdom 0.8.4'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
................................................................................
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
  # Omit some internal or obsolete options to make the list less imposing.
  # This message is too long to be a string in the A/UX 3.1 sh.
  cat <<_ACEOF
\`configure' configures tdom 0.8.4 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.
................................................................................

  cat <<\_ACEOF
_ACEOF
fi

if test -n "$ac_init_help"; then
  case $ac_init_help in
     short | recursive ) echo "Configuration of tdom 0.8.4:";;
   esac
  cat <<\_ACEOF

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
................................................................................
    cd "$ac_pwd" || { ac_status=$?; break; }
  done
fi

test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
  cat <<\_ACEOF
tdom configure 0.8.4
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
  exit
................................................................................
  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno

} # ac_fn_c_check_header_mongrel
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by tdom $as_me 0.8.4, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ $0 $@

_ACEOF
exec 5>>config.log
{
................................................................................

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct TEA configuration" >&5
$as_echo_n "checking for correct TEA configuration... " >&6; }
    if test x"${PACKAGE_NAME}" = x ; then
	as_fn_error $? "
The PACKAGE_NAME variable must be defined by your TEA configure.ac" "$LINENO" 5
    fi
    if test x"3.9" = x ; then
	as_fn_error $? "
TEA version not specified." "$LINENO" 5
    elif test "3.9" != "${TEA_VERSION}" ; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&5
$as_echo "warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&6; }
    else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5
$as_echo "ok (TEA ${TEA_VERSION})" >&6; }
    fi

    # If the user did not set CFLAGS, set it now to keep macros
    # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2".
................................................................................
    if test "$tcl_ok" = "yes" ; then
        HAVEGUMBO=`pkg-config --exists gumbo && echo "1"`
        if test "$HAVEGUMBO" = "1" ; then
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
            $as_echo "#define TDOM_HAVE_GUMBO 1" >>confdefs.h




            HTML5_LIBS="`pkg-config --cflags --libs gumbo`"

        else
            as_fn_error $? "The required lib gumbo not found" "$LINENO" 5
        fi
    else
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
    fi
................................................................................
# and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var.
#
# A few miscellaneous platform-specific items:
# TEA_ADD_* any platform specific compiler/build info here.
#--------------------------------------------------------------------

if test "${TEA_PLATFORM}" = "windows" ; then
    $as_echo "#define BUILD_tdom 1" >>confdefs.h

    CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch"
    #TEA_ADD_SOURCES([win/winFile.c])
    #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
else
    CLEANFILES="pkgIndex.tcl tdomConfig.sh tdom.tcl tcldomsh"
    #TEA_ADD_SOURCES([unix/unixFile.c])
    #TEA_ADD_LIBS([-lsuperfly])
................................................................................
test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1

cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by tdom $as_me 0.8.4, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  CONFIG_FILES    = $CONFIG_FILES
  CONFIG_HEADERS  = $CONFIG_HEADERS
  CONFIG_LINKS    = $CONFIG_LINKS
  CONFIG_COMMANDS = $CONFIG_COMMANDS
  $ $0 $@
................................................................................

Report bugs to the package provider."

_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
tdom config.status 0.8.4
configured by $0, generated by GNU Autoconf 2.69,
  with options \\"\$ac_cs_config\\"

Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."



|







 







|
|







 







|







 







|







 







|







 







|







 







|


|
|
|







 







>
>
>
|
>







 







<
<







 







|







 







|







1
2
3
4
5
6
7
8
9
10
...
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
....
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
....
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
....
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
....
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
....
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
....
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
....
5701
5702
5703
5704
5705
5706
5707


5708
5709
5710
5711
5712
5713
5714
....
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
....
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for tdom 0.9.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
................................................................................
subdirs=
MFLAGS=
MAKEFLAGS=

# Identity of this package.
PACKAGE_NAME='tdom'
PACKAGE_TARNAME='tdom'
PACKAGE_VERSION='0.9.0'
PACKAGE_STRING='tdom 0.9.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
................................................................................
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
  # Omit some internal or obsolete options to make the list less imposing.
  # This message is too long to be a string in the A/UX 3.1 sh.
  cat <<_ACEOF
\`configure' configures tdom 0.9.0 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.
................................................................................

  cat <<\_ACEOF
_ACEOF
fi

if test -n "$ac_init_help"; then
  case $ac_init_help in
     short | recursive ) echo "Configuration of tdom 0.9.0:";;
   esac
  cat <<\_ACEOF

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
................................................................................
    cd "$ac_pwd" || { ac_status=$?; break; }
  done
fi

test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
  cat <<\_ACEOF
tdom configure 0.9.0
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
  exit
................................................................................
  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno

} # ac_fn_c_check_header_mongrel
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by tdom $as_me 0.9.0, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ $0 $@

_ACEOF
exec 5>>config.log
{
................................................................................

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct TEA configuration" >&5
$as_echo_n "checking for correct TEA configuration... " >&6; }
    if test x"${PACKAGE_NAME}" = x ; then
	as_fn_error $? "
The PACKAGE_NAME variable must be defined by your TEA configure.ac" "$LINENO" 5
    fi
    if test x"3.10" = x ; then
	as_fn_error $? "
TEA version not specified." "$LINENO" 5
    elif test "3.10" != "${TEA_VERSION}" ; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"3.10\", have \"${TEA_VERSION}\"" >&5
$as_echo "warning: requested TEA version \"3.10\", have \"${TEA_VERSION}\"" >&6; }
    else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5
$as_echo "ok (TEA ${TEA_VERSION})" >&6; }
    fi

    # If the user did not set CFLAGS, set it now to keep macros
    # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2".
................................................................................
    if test "$tcl_ok" = "yes" ; then
        HAVEGUMBO=`pkg-config --exists gumbo && echo "1"`
        if test "$HAVEGUMBO" = "1" ; then
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
            $as_echo "#define TDOM_HAVE_GUMBO 1" >>confdefs.h

            if test "${TEA_PLATFORM}" = "windows" ; then
                HTML5_LIBS="-Wl,-Bstatic `pkg-config --static --cflags --libs gumbo` -Wl,-Bdynamic"
            else
                HTML5_LIBS="`pkg-config --cflags --libs gumbo`"
            fi
        else
            as_fn_error $? "The required lib gumbo not found" "$LINENO" 5
        fi
    else
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
    fi
................................................................................
# and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var.
#
# A few miscellaneous platform-specific items:
# TEA_ADD_* any platform specific compiler/build info here.
#--------------------------------------------------------------------

if test "${TEA_PLATFORM}" = "windows" ; then


    CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch"
    #TEA_ADD_SOURCES([win/winFile.c])
    #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
else
    CLEANFILES="pkgIndex.tcl tdomConfig.sh tdom.tcl tcldomsh"
    #TEA_ADD_SOURCES([unix/unixFile.c])
    #TEA_ADD_LIBS([-lsuperfly])
................................................................................
test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1

cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by tdom $as_me 0.9.0, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  CONFIG_FILES    = $CONFIG_FILES
  CONFIG_HEADERS  = $CONFIG_HEADERS
  CONFIG_LINKS    = $CONFIG_LINKS
  CONFIG_COMMANDS = $CONFIG_COMMANDS
  $ $0 $@
................................................................................

Report bugs to the package provider."

_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
tdom config.status 0.9.0
configured by $0, generated by GNU Autoconf 2.69,
  with options \\"\$ac_cs_config\\"

Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."

Changes to configure.in.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
...
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION
# set as provided.  These will also be added as -D defs in your Makefile
# so you can encode the package version directly into the source files.
# This will also define a special symbol for Windows (BUILD_sample in
# this case) so that we create the export library with the dll.
#-----------------------------------------------------------------------

AC_INIT([tdom], [0.8.4])

#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------

TEA_INIT([3.9])

AC_CONFIG_AUX_DIR(tclconfig)

#--------------------------------------------------------------------
# Load the tclConfig.sh file
#--------------------------------------------------------------------

................................................................................
# and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var.
#
# A few miscellaneous platform-specific items:
# TEA_ADD_* any platform specific compiler/build info here.
#--------------------------------------------------------------------

if test "${TEA_PLATFORM}" = "windows" ; then
    AC_DEFINE(BUILD_tdom)
    CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch"
    #TEA_ADD_SOURCES([win/winFile.c])
    #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
else
    CLEANFILES="pkgIndex.tcl tdomConfig.sh tdom.tcl tcldomsh"
    #TEA_ADD_SOURCES([unix/unixFile.c])
    #TEA_ADD_LIBS([-lsuperfly])







|







|







 







<







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
...
125
126
127
128
129
130
131

132
133
134
135
136
137
138
# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION
# set as provided.  These will also be added as -D defs in your Makefile
# so you can encode the package version directly into the source files.
# This will also define a special symbol for Windows (BUILD_sample in
# this case) so that we create the export library with the dll.
#-----------------------------------------------------------------------

AC_INIT([tdom], [0.9.0])

#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------

TEA_INIT([3.10])

AC_CONFIG_AUX_DIR(tclconfig)

#--------------------------------------------------------------------
# Load the tclConfig.sh file
#--------------------------------------------------------------------

................................................................................
# and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var.
#
# A few miscellaneous platform-specific items:
# TEA_ADD_* any platform specific compiler/build info here.
#--------------------------------------------------------------------

if test "${TEA_PLATFORM}" = "windows" ; then

    CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch"
    #TEA_ADD_SOURCES([win/winFile.c])
    #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
else
    CLEANFILES="pkgIndex.tcl tdomConfig.sh tdom.tcl tcldomsh"
    #TEA_ADD_SOURCES([unix/unixFile.c])
    #TEA_ADD_LIBS([-lsuperfly])

Changes to doc/category-index.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<html>
<head>
<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 $">
</head><body>
<div class="header">
<h1 class="title" align="center">tDOM manual: Index</h1><p class="navaid" align="center">
<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>
</p><hr class="navsep"><div class="navbar">
<a href="#cat_cmd">Tcl commands</a> · <a href="#cat_fun">C functions</a> · </div>
</div><div class="body">
<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,
         CHandlerSetCreate, CHandlerSetGetUserData, GetExpatInfo</a>
</div><div class="footer">
<hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</div>
</body>
</html>


|



|

|

|



|




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<html>
<head>
<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">
</head><body>
<div class="header">
<h1 class="title" align="center">tDOM manual: Index</h1><p class="navaid" align="center">
<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>
</p><hr class="navsep"><div class="navbar">
<a href="#cat_cmd">Tcl commands</a> · <a href="#cat_fun">C functions</a> · </div>
</div><div class="body">
<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,
         CHandlerSetCreate, CHandlerSetGetUserData, GetExpatInfo</a>
</div><div class="footer">
<hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</div>
</body>
</html>

Changes to doc/dom.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
..
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...
118
119
120
121
122
123
124
125

















126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152

153
154
155
156
157
158
159
160
161
162

163
164
165

166
167
168

169
170
171
172
173
174
175
176
177
178
179
180
181
...
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237

238
239
240

241

242
243

244
245

246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264

265
266
267
268
269
270
271
...
290
291
292
293
294
295
296
297
298
299
300
301
302
303


304

305
306
307
308
309

310
311

312
313
314
315
316
317
318
319
320
321
322
323
324
...
336
337
338
339
340
341
342
343
344
345
346
347
348
349









350
351
352
353
354
355
356
357
...
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
...
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
...
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
...
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
<html>
<head>
<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 $">
</head><body>
<div class="header">
<div class="navbar" align="center">
<a href="#SECTid0xb56980">NAME</a> · <a href="#SECTid0xa76ae0">SYNOPSIS</a> · <a href="#SECTid0xb62b50">DESCRIPTION </a> · <a href="#SECTid0xb84020">KEYWORDS</a>
</div><hr class="navsep">
</div><div class="body">
  <h2><a name="SECTid0xb56980">NAME</a></h2><p class="namesection">
<b class="names">dom - </b><br>Create an in-memory DOM tree from XML</p>
  
  <h2><a name="SECTid0xa76ae0">SYNOPSIS</a></h2><pre class="syntax">package require tdom

<b class="cmd">dom</b> <i class="m">method</i> ?<i class="m">arg arg ...</i>?</pre>

  <h2><a name="SECTid0xb62b50">DESCRIPTION </a></h2><p>This command provides the creation of DOM trees in memory. In
the usual case a string containing a XML information is parsed and converted
into a DOM tree. Other possible parse input may be HTML or JSON.
The <i class="m">method</i> indicates a specific subcommand. </p><p>The valid methods are:</p><dl class="commandlist">
        
          <dt>
<b class="cmd">dom</b> <b class="method">parse</b> ?<i class="m">options</i>? ?<i class="m">data</i>?</dt>
          <dd>Parses the XML information and builds up the DOM tree in memory
................................................................................
              
                <dt><b>-simple</b></dt> 
                <dd>If <i class="m">-simple</i> is
specified, a simple but fast parser is used (conforms not fully to XML
recommendation). That should double parsing and DOM generation speed. The
encoding of the data is not transformed inside the parser. The simple parser
does not respect any encoding information in the XML declaration. It skips over
the internal DTD subset and ignores any information in it. Therefor it doesn't
include defaulted attribute values into the tree, even if the according
attribute declaration is in the internal subset. It also doesn't expand
internal or external entity references other than the predefined entities and
character references.</dd>
              

              
................................................................................
                <dt><b>-html</b></dt>
                <dd>If <i class="m">-html</i> is specified, a fast HTML parser is 
used, which tries to even parse badly formed HTML into a DOM tree.</dd>
              

              
                <dt><b>-html5</b></dt>
                <dd>This option is only available, if tDOM was build
                with --enable-html5. Try the <i class="m">featureinfo</i> method
                if you need to know, if this feature is build in. If
                <i class="m">-html5</i> is specified, the gumbo lib html5 parser
                (https://github.com/google/gumbo-parser) is used, to
                build the DOM tree. This is, as far as it goes, XML
                namespace aware. Since this probably isn't wanted by a
                lot of users and adds only burden for no good in a lot
                of use cases <i class="m">-html5</i> can be combined with
                <i class="m">-ignorexmlns</i>, in which case all nodes and
                attributes in the DOM tree are not in an XML
                namespace. All tag and attribute names in the DOM tree
                will be lower case, even for foreign elements not in
                the xhtml, svg or mathml namespace. The DOM tree may
                include nodes, that the parser inserted, because they
                are implied by the context (as &lt;head&gt;,
                &lt;tbody&gt;, etc.).</dd>
              

              
                <dt><b>-json</b></dt>
                <dd>If <i class="m">-json</i> is specified, the <i class="m">data</i> is
................................................................................
                command or handle is an ordinary DOM doc, which may be
                investigated or modified with the full range of the
                doc and node methods. Please note that the element
                node names and the text node values within the tree
                may be outside of what the appropriate XML productions
                allow.</dd>
              
              

















              
                <dt><b>-keepEmpties</b></dt> 
                <dd>If <i class="m">-keepEmpties</i> is
specified, text nodes, which contain only whitespaces, will be part of the
resulting DOM tree. In default case (<i class="m">-keepEmpties</i> not given) those empty
text nodes are removed at parsing time.</dd>
              

              
                <dt>
<b>-channel</b> <i>&lt;channel-ID&gt;</i>
</dt>
                
                <dd>If <i class="m">-channel &lt;channel-ID&gt;</i> is specified, the
input to be parsed is read from the specified channel. The encoding setting of
the channel (via fconfigure -encoding) is respected, ie the data read from the
channel are converted to UTF-8 according to the encoding settings, befor the
data is parsed.</dd>
              

              
                <dt>
<b>-baseurl</b> <i>&lt;baseURI&gt;</i>
</dt>
                
                <dd>If <i class="m">-baseurl &lt;baseURI&gt;</i> is specified, the
baseURI is used as the base URI of the document. External entities referenced

in the document are resolved relative to this base URI. This base URI is also
stored within the DOM tree.</dd>
              

              
                <dt>
<b>-feedbackAfter</b> <i>&lt;#bytes&gt;</i>
</dt>
                
                <dd>If <i class="m">-feedbackAfter &lt;#bytes&gt;</i> is specified, the

tcl command given by <i class="m">-feedbackcmd</i> is evaluated at the first
element start within the document (or an external entity) after the
start of the document or external entity or the last such call after

#bytes.For backward compatibility, if no -feedbackcmd is given, but
there is a tcl proc named ::dom::domParseFeedback then this proc is
used as -feedbackcmd. If there isn't such a proc and -feedbackAfter is

used, it is an error to not also use -feedbackcmd. If the called
script raises error, then parsing will be aborted, the
<i class="m">dom parse</i> call returns error, with the script
error msg as error msg. If the called script <i class="m">return
-code break</i>, the parsing will abort and the <i class="m">dom
parse</i> call will return the empty string.</dd>
              

              
                <dt>
<b>-feedbackcmd</b> <i>&lt;script&gt;</i>
</dt>
                
................................................................................
                
                <dd>If <i class="m">-externalentitycommand &lt;script&gt;</i> is
specified, the specified tcl script is called to resolve any external entities
of the document. The actual evaluated command consists of this option followed
by three arguments: the base uri, the system identifier of the entity and the
public identifier of the entity. The base uri and the public identifier may be
the empty list. The script has to return a tcl list consisting of three
elements. The first element of this list signals, how the external entity is
returned to the processor. At the moment, the two allowed types are "string"
and "channel". The second element of the list has to be the (absolute) base URI
of the external entity to be parsed.  The third element of the list are data,
either the already read data out of the external entity as string in the case
of type "string", or the name of a tcl channel, in the case of type
"channel". Note that if the script returns a tcl channel, it will not be closed
by the processor.  It must be closed separately if it is no longer
required.</dd>
              

              
                <dt>
<b>-useForeignDTD</b> <i>&lt;boolean&gt;</i>
</dt>
                
                <dd>If &lt;boolean&gt; is true and the document does not have
an external subset, the parser will call the -externalentitycommand script with
empty values for the systemId and publicID arguments. Pleace notice, that, if
the document also doesn't have an internal subset, the
-startdoctypedeclcommand and -enddoctypedeclcommand scripts, if set, are not
called. The <i class="m">-useForeignDTD</i> respects </dd>
              

              
                <dt>
<b>-paramentityparsing</b> <i>&lt;always|never|notstandalone&gt;</i>
</dt>
                
                <dd>The <i class="m">-paramentityparsing</i> option controls, if the
parser tries to resolve the external entities (including the external DTD

subset) of the document, while building the DOM
tree. <i class="m">-paramentityparsing</i> requires an argument, which must be either
"always", "never", or "notstandalone". The value "always" means, that the

parser tries to resolves (recursively) all external entities of the XML

source. This is the default, in case <i class="m">-paramentityparsing</i> is omitted. The
value "never" means, that only the given XML source is parsed and no external

entity (including the external subset) will be resolved and parsed. The value
"notstandalone" means, that all external entities will be resolved and parsed,

with the execption of documents, which explicitly states standalone="yes" in
their XML declaration.</dd>
              


              
                <dt><b>-ignorexmlns</b></dt>
                <dd>It is recommended, that you only use this option
                together with the <i class="m">-html5</i> option, if ever. If
                this option is given, no node within the created DOM
                tree will be internally marked as placed into an XML
                Namespace, even if there is a default namespace in
                scope for un-prefixed elements or even if the element
                has a defined namespace prefix. One consequence is of
                this is, that XPath node expressions on such a DOM
                tree doesn't work as expected. Prefixed element nodes
                can't be selected and element nodes without prefix
                will be seen by XPath expressions as if they haven't
                any namespace (no matter if they in fact in a default

                namespace).
                </dd>
              

            </dl>
<p></p>
</dd>
................................................................................
memory handling as explained above.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">createDocumentNode</b>
?<i class="m">objVar</i>?</dt>
          <dd>Creates a new, 'empty' DOM document object without any element
node. <i class="m">objVar</i> controls the memory handling as explained above.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">setResultEncoding</b> ?<i class="m">encodingName</i>?</dt>


          <dd>If <i class="m">encodingName</i> is not given the current global

result encoding is returned.  Otherwise the global result encoding is set to
<i class="m">encodingName</i>.  All character data, attribute values, etc. will
then be converted from UTF-8, which is delivered from the Expat XML parser, to
the given 8 bit encoding at XML/DOM parse time.  Valid values for
<i class="m">encodingName</i> are: utf-8, ascii, cp1250, cp1251, cp1252, cp1253,

cp1254, cp1255, cp1256, cp437, cp850, en, iso8859-1, iso8859-2, iso8859-3,
iso8859-4, iso8859-5, iso8859-6, iso8859-7, iso8859-8, iso8859-9, koi8-r.</dd>

        

        
          <dt>
<b class="cmd">dom</b> <b class="method">createNodeCmd</b>
<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>
</dt>
          <dd>This method creates Tcl commands, which in turn create
          tDOM nodes. Tcl commands created by this command are only
          avaliable inside a script given to the domNode methods
          <i class="m">appendFromScript</i> or <i class="m">insertBeforeFromScript</i>. If
          a command created with <i class="m">createNodeCmd</i> is invoked in
          any other context, it will return error. The created command
................................................................................
option <i class="m">-returnNodeCmd</i> was given, the command returns the
created node as Tcl command. If this option was omitted, the command
returns nothing. Each command creates always the same type of node.
Which type of node is created by the command is determined by the
first argument to the <i class="m">createNodeCmd</i>. The syntax of the created
command depends on the type of the node it creates.</p>

<p>If the first argument of the method is <i class="m">elementNode</i>, the
created command will create an element node. Without the
<i class="m">-tagName</i> option the tag name of the created node is
<i class="m">commandName</i> without namespace qualifiers. If the
<i class="m">-tagName</i> option was given then the created command the created
elements will have this tag name. If the <i class="m">-jsonType</i> option was
given then the created node elements will have the given JSON type.









The syntax of the created command is:</p>

<pre class="syntax">
<b class="cmd">elementNodeCmd</b> <i class="m">?attributeName attributeValue ...? ?script?</i>
<b class="cmd">elementNodeCmd</b> <i class="m">?-attributeName attributeValue ...? ?script?</i>
<b class="cmd">elementNodeCmd</b> <i class="m">name_value_list script</i>
</pre>

................................................................................
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">setStoreLineColumn</b> <i class="m">?boolean</i>?</dt>
          <dd>If switched on, the DOM nodes will contain line and column
position information for the original XML document after parsing. The default
is, not to store line and column position information.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">setNameCheck</b> <i class="m">?boolean</i>?</dt>
          <dd>If NameCheck is true, every method which expects an XML Name,
a full qualified name or a processing instructing target will check, if the
given string is valid according to his production rule. For commands created
with the <i class="m">createNodeCmd</i> method to be used in the context of
<i class="m">appendFromScript</i> the status of the flag at creation time
decides. If NameCheck is true at creation time, the command will
check his arguments, otherwise not. The <i class="m">setNameCheck</i>
set this flag. It returns the current NameCheck flag state. The
default state for NameCheck is true. </dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">setTextCheck</b> <i class="m">?boolean</i>?</dt>
          <dd>If TextCheck is true, every command which expects XML Chars,
a comment, a CDATA section value or a processing instructing value will check,
if the given string is valid according to his production rule. For commands
created with the <i class="m">createNodeCmd</i> method to be used in the
context of <i class="m">appendFromScript</i> the status of the flag at
creation time decides. If TextCheck is true at creation time, the
command will check his arguments, otherwise not.The
<i class="m">setTextCheck</i> method set this flag. It returns the current
TextCheck flag state. The default state for TextCheck is true.</dd>
      

        
          <dt>
<b class="cmd">dom</b> <b class="method">setObjectCommands</b> ?<i class="m">(automatic|token|command)</i>?</dt>
          <dd>Controls, if documents and nodes are created as tcl commands or
as token to be
used with the domNode and domDoc commands. If the mode is
'automatic', then methods used at tcl commands will create tcl
commands and methods used at doc or node tokes will create tokens. If
the mode is 'command' then always tcl commands will be created. If
the mode is 'token', then always token will be created. The method
returns the current mode. This method is an experimental interface.</dd>
      

        
          <dt>
<b class="cmd">dom</b> <b class="method">isName</b> <i class="m">name</i>
</dt>
          <dd>Returns 1, if <i class="m">name</i> is a valid XML Name according to
production 5 of the <a href="http://www.w3.org/TR/2004/REC-xml-20040204/#NT-NameChar">XML
            1.0</a> recommendation. This means, that <i class="m">name</i> is a valid
          XML element or attribute name. Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isPIName</b> <i class="m">name</i>
</dt>
          <dd>Returns 1, if <i class="m">name</i> is a valid XML processing instruction
          target according to
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>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isNCName</b> <i class="m">name</i>
</dt>
          <dd>Returns 1, if <i class="m">name</i> is a valid NCName according
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
0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isQName</b> <i class="m">name</i>
</dt>
          <dd>Returns 1, if <i class="m">name</i> is a valid QName according
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
0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isCharData</b>
<i class="m">string</i>
</dt>
          <dd>Returns 1, if every character in <i class="m">string</i> is
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>
recommendation. Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isBMPCharData</b>
<i class="m">string</i>
</dt>
          <dd>Returns 1, if every character in <i class="m">string</i> is
a valid XML Char with a Unicode code point within the Basic
Multilingual Plane (that means, that every character within the string
is at most 3 bytes long). Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isComment</b>
<i class="m">string</i>
</dt>
          <dd>Returns 1, if <i class="m">string</i> is
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>
recommendation. Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isCDATA</b>
<i class="m">string</i>
</dt>
          <dd>Returns 1, if <i class="m">string</i> is
valid according to production 20 of the <a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XML 1.0</a>
recommendation. Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isPIValue</b>
<i class="m">string</i>
</dt>
          <dd>Returns 1, if <i class="m">string</i> is
valid according to production 16 of the <a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XML 1.0</a>
recommendation. Otherwise it returns 0.</dd>
        

        
            <dt>
<b class="cmd">dom</b> <b class="method">featureinfo</b> <i class="m">feature</i>
................................................................................
            build options and the expat version. The valid values for
            the <i class="m">feature</i> argument are:
            <dl class="optlist">
                
                    <dt><b>expatversion</b></dt>
                    <dd>Returns the version of the underlyling expat
                    version as string, something like
                    "exapt_2.1.0". This is. what the expat API
                    function XML_ExpatVersion() returns.</dd>
                
                
                    <dt><b>expatmajorversion</b></dt>
                    <dd>Returns the major version of the underlyling
                    expat version as integer.</dd>
                
................................................................................
                
                    <dt><b>expatmicroversion</b></dt>
                    <dd>Returns the micro version of the underlyling
                    expat version as integer.</dd>
                
                
                    <dt><b>dtd</b></dt>
                    <dd>Returns as boolean, if build with
                    <i class="m">--enable-dtd</i>.</dd>
                
                
                    <dt><b>ns</b></dt>
                    <dd>Returns as boolean, if build with
                    <i class="m">--enable-ns</i>.</dd>
                
                
                    <dt><b>unknown</b></dt>
                    <dd>Returns as boolean, if build with
                    <i class="m">--enable-unknown</i>.</dd>
                
                
                    <dt><b>tdomalloc</b></dt>
                    <dd>Returns as boolean, if build with
                    <i class="m">--enable-tdomalloc</i>.</dd>
                
                
                    <dt><b>lessns</b></dt>
                    <dd>Returns as boolean, if build with
                    <i class="m">--enable-lessns</i>.</dd>
                
                
                    <dt><b>TCL_UTF_MAX</b></dt>
                    <dd>Returns the TCL_UTF_MAX value of the tcl
                    core, tDOM was build with as integer</dd>
                
................................................................................
                    <i class="m">--enable-html5</i>.</dd>
                
            </dl>
            </dd>   
        
    </dl>

<h2><a name="SECTid0xb84020">KEYWORDS</a></h2><p class="keywords">
<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>
</p>
</div><hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</body>
</html>


|



|


|


|



|







 







|







 







|

|

|

|







|







 







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



|












|








|
|
>
|
|







|
>
|
|
|
>
|
|
|
>
|
|
|
|
|
|







 







|
|






|









|










|
|
>
|
|
|
>
|
>
|
|
>
|
|
>
|
|






|
|
|
|
|
|
|
|
|
|
<
>







 







|






>
>
|
>
|
|
|
|
|
>
|
|
>





|







 







|
|




|
>
>
>
>
>
>
>
>
>
|







 







|







|



|









|



|
|






|













|

|







|








|








|









|









|










|









|









|







 







|







 







|




|




|




|




|







 







|



|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
..
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
...
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289

290
291
292
293
294
295
296
297
...
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
...
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
...
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
...
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
...
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
...
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
<html>
<head>
<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">
</head><body>
<div class="header">
<div class="navbar" align="center">
<a href="#SECTid0x1f2bd90">NAME</a> · <a href="#SECTid0x1e4db70">SYNOPSIS</a> · <a href="#SECTid0x1f36320">DESCRIPTION </a> · <a href="#SECTid0x1f86b10">KEYWORDS</a>
</div><hr class="navsep">
</div><div class="body">
  <h2><a name="SECTid0x1f2bd90">NAME</a></h2><p class="namesection">
<b class="names">dom - </b><br>Create an in-memory DOM tree from XML</p>
  
  <h2><a name="SECTid0x1e4db70">SYNOPSIS</a></h2><pre class="syntax">package require tdom

<b class="cmd">dom</b> <i class="m">method</i> ?<i class="m">arg arg ...</i>?</pre>

  <h2><a name="SECTid0x1f36320">DESCRIPTION </a></h2><p>This command provides the creation of DOM trees in memory. In
the usual case a string containing a XML information is parsed and converted
into a DOM tree. Other possible parse input may be HTML or JSON.
The <i class="m">method</i> indicates a specific subcommand. </p><p>The valid methods are:</p><dl class="commandlist">
        
          <dt>
<b class="cmd">dom</b> <b class="method">parse</b> ?<i class="m">options</i>? ?<i class="m">data</i>?</dt>
          <dd>Parses the XML information and builds up the DOM tree in memory
................................................................................
              
                <dt><b>-simple</b></dt> 
                <dd>If <i class="m">-simple</i> is
specified, a simple but fast parser is used (conforms not fully to XML
recommendation). That should double parsing and DOM generation speed. The
encoding of the data is not transformed inside the parser. The simple parser
does not respect any encoding information in the XML declaration. It skips over
the internal DTD subset and ignores any information in it. Therefore it doesn't
include defaulted attribute values into the tree, even if the according
attribute declaration is in the internal subset. It also doesn't expand
internal or external entity references other than the predefined entities and
character references.</dd>
              

              
................................................................................
                <dt><b>-html</b></dt>
                <dd>If <i class="m">-html</i> is specified, a fast HTML parser is 
used, which tries to even parse badly formed HTML into a DOM tree.</dd>
              

              
                <dt><b>-html5</b></dt>
                <dd>This option is only available if tDOM was build
                with --enable-html5. Try the <i class="m">featureinfo</i> method
                if you need to know if this feature is build in. If
                <i class="m">-html5</i> is specified, the gumbo lib html5 parser
                (https://github.com/google/gumbo-parser) is used to
                build the DOM tree. This is, as far as it goes, XML
                namespace-aware. Since this probably isn't wanted by a
                lot of users and adds only burden for no good in a lot
                of use cases <i class="m">-html5</i> can be combined with
                <i class="m">-ignorexmlns</i>, in which case all nodes and
                attributes in the DOM tree are not in an XML
                namespace. All tag and attribute names in the DOM tree
                will be lower case, even for foreign elements not in
                the xhtml, svg or mathml namespace. The DOM tree may
                include nodes, that the parser inserted because they
                are implied by the context (as &lt;head&gt;,
                &lt;tbody&gt;, etc.).</dd>
              

              
                <dt><b>-json</b></dt>
                <dd>If <i class="m">-json</i> is specified, the <i class="m">data</i> is
................................................................................
                command or handle is an ordinary DOM doc, which may be
                investigated or modified with the full range of the
                doc and node methods. Please note that the element
                node names and the text node values within the tree
                may be outside of what the appropriate XML productions
                allow.</dd>
              

              
                <dt>
<b>-jsonmaxnesting</b> <i>integer</i>
</dt>
                
                <dd>This options only has effect if used together
                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>
              
              
              
                <dt><b>--</b></dt> 
                <dd>The option <i class="m">--</i> marks the end of options.
                While respected in general this option is only needed
                in case of parsing JSON data, which may start with a
                "-".</dd>
              

              
                <dt><b>-keepEmpties</b></dt> 
                <dd>If <i class="m">-keepEmpties</i> is
specified then text nodes which contain only whitespaces will be part of the
resulting DOM tree. In default case (<i class="m">-keepEmpties</i> not given) those empty
text nodes are removed at parsing time.</dd>
              

              
                <dt>
<b>-channel</b> <i>&lt;channel-ID&gt;</i>
</dt>
                
                <dd>If <i class="m">-channel &lt;channel-ID&gt;</i> is specified, the
input to be parsed is read from the specified channel. The encoding setting of
the channel (via fconfigure -encoding) is respected, ie the data read from the
channel are converted to UTF-8 according to the encoding settings before the
data is parsed.</dd>
              

              
                <dt>
<b>-baseurl</b> <i>&lt;baseURI&gt;</i>
</dt>
                
                <dd>If <i class="m">-baseurl &lt;baseURI&gt;</i> is specified,
                the baseURI is used as the base URI of the document.
                External entities references in the document are
                resolved relative to this base URI. This base URI is
                also stored within the DOM tree.</dd>
              

              
                <dt>
<b>-feedbackAfter</b> <i>&lt;#bytes&gt;</i>
</dt>
                
                <dd>If <i class="m">-feedbackAfter &lt;#bytes&gt;</i> is
                specified, the tcl command given by
                <i class="m">-feedbackcmd</i> is evaluated at the first element
                start within the document (or an external entity)
                after the start of the document or external entity or
                the last such call after #bytes. For backward
                compatibility if no -feedbackcmd is given but there is
                a tcl proc named ::dom::domParseFeedback this proc is
                used as -feedbackcmd. If there isn't such a proc and
                -feedbackAfter is used it is an error to not also use
                -feedbackcmd. If the called script raises error, then
                parsing will be aborted, the <i class="m">dom parse</i> call
                returns error, with the script error msg as error msg.
                If the called script <i class="m">return -code break</i>, the
                parsing will abort and the <i class="m">dom parse</i> call will
                return the empty string.</dd>
              

              
                <dt>
<b>-feedbackcmd</b> <i>&lt;script&gt;</i>
</dt>
                
................................................................................
                
                <dd>If <i class="m">-externalentitycommand &lt;script&gt;</i> is
specified, the specified tcl script is called to resolve any external entities
of the document. The actual evaluated command consists of this option followed
by three arguments: the base uri, the system identifier of the entity and the
public identifier of the entity. The base uri and the public identifier may be
the empty list. The script has to return a tcl list consisting of three
elements. The first element of this list signals how the external entity is
returned to the processor. Currently the two allowed types are "string"
and "channel". The second element of the list has to be the (absolute) base URI
of the external entity to be parsed.  The third element of the list are data,
either the already read data out of the external entity as string in the case
of type "string", or the name of a tcl channel, in the case of type
"channel". Note that if the script returns a tcl channel, it will not be closed
by the processor.  It must be closed separately if it is no longer
needed.</dd>
              

              
                <dt>
<b>-useForeignDTD</b> <i>&lt;boolean&gt;</i>
</dt>
                
                <dd>If &lt;boolean&gt; is true and the document does not have
an external subset, the parser will call the -externalentitycommand script with
empty values for the systemId and publicID arguments. Please note that if
the document also doesn't have an internal subset, the
-startdoctypedeclcommand and -enddoctypedeclcommand scripts, if set, are not
called. The <i class="m">-useForeignDTD</i> respects </dd>
              

              
                <dt>
<b>-paramentityparsing</b> <i>&lt;always|never|notstandalone&gt;</i>
</dt>
                
                <dd>The <i class="m">-paramentityparsing</i> option controls,
                if the parser tries to resolve the external entities
                (including the external DTD subset) of the document
                while building the DOM tree.
                <i class="m">-paramentityparsing</i> requires an argument, which
                must be either "always", "never", or "notstandalone".
                The value "always" means that the parser tries to
                resolves (recursively) all external entities of the
                XML source. This is the default in case
                <i class="m">-paramentityparsing</i> is omitted. The value
                "never" means that only the given XML source is
                parsed and no external entity (including the external
                subset) will be resolved and parsed. The value
                "notstandalone" means, that all external entities will
                be resolved and parsed, with the execption of
                documents, which explicitly states standalone="yes" in
                their XML declaration.</dd>
              


              
                <dt><b>-ignorexmlns</b></dt>
                <dd>It is recommended, that you only use this option
                with the <i class="m">-html5</i> option. If this option is
                given, no node within the created DOM tree will be
                internally marked as placed into an XML Namespace,
                even if there is a default namespace in scope for
                un-prefixed elements or even if the element has a
                defined namespace prefix. One consequence is that
                XPath node expressions on such a DOM tree doesn't work
                as expected. Prefixed element nodes can't be selected
                and element nodes without prefix will be seen by XPath
                expressions as if they are not in any namespace (no

                matter if they are in fact should be in a default
                namespace).
                </dd>
              

            </dl>
<p></p>
</dd>
................................................................................
memory handling as explained above.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">createDocumentNode</b>
?<i class="m">objVar</i>?</dt>
          <dd>Creates a new 'empty' DOM document object without any element
node. <i class="m">objVar</i> controls the memory handling as explained above.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">setResultEncoding</b> ?<i class="m">encodingName</i>?</dt>
          <dd>This option is for backward compatibility with Tcl
          8.0. If tDOM is build with any newer Tcl version this option
          does not has any effect. If <i class="m">encodingName</i> is not given
          the current global result encoding is returned. Otherwise
          the global result encoding is set to <i class="m">encodingName</i>.
          All character data, attribute values etc. will then be
          converted from UTF-8, which is delivered from the Expat XML
          parser, to the given 8 bit encoding at XML/DOM parse time.
          Valid values for <i class="m">encodingName</i> are: utf-8, ascii,
          cp1250, cp1251, cp1252, cp1253, cp1254, cp1255, cp1256,
          cp437, cp850, en, iso8859-1, iso8859-2, iso8859-3,
          iso8859-4, iso8859-5, iso8859-6, iso8859-7, iso8859-8,
          iso8859-9, koi8-r.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">createNodeCmd</b>
<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>
</dt>
          <dd>This method creates Tcl commands, which in turn create
          tDOM nodes. Tcl commands created by this command are only
          avaliable inside a script given to the domNode methods
          <i class="m">appendFromScript</i> or <i class="m">insertBeforeFromScript</i>. If
          a command created with <i class="m">createNodeCmd</i> is invoked in
          any other context, it will return error. The created command
................................................................................
option <i class="m">-returnNodeCmd</i> was given, the command returns the
created node as Tcl command. If this option was omitted, the command
returns nothing. Each command creates always the same type of node.
Which type of node is created by the command is determined by the
first argument to the <i class="m">createNodeCmd</i>. The syntax of the created
command depends on the type of the node it creates.</p>

<p>If the command type to create is <i class="m">elementNode</i>, the created
command will create an element node, if called. Without the
<i class="m">-tagName</i> option the tag name of the created node is
<i class="m">commandName</i> without namespace qualifiers. If the
<i class="m">-tagName</i> option was given then the created command the created
elements will have this tag name. If the <i class="m">-jsonType</i> option was
given then the created node elements will have the given JSON type. If
the <i class="m">-namespace</i> option is given the created element node will be
XML namespaced and in the namespace given by the option. The element
name will be literal as given either by the command name or the
<i class="m">-tagname</i> option, if that was given. An appropriate XML
namespace declaration will be automatically added, to bind the prefix
(if the element name has one) or the default namespace (if the element
name hasn't a prefix) to the namespace if such a binding isn't in
scope.</p>

<p>The syntax of the created command is:</p>

<pre class="syntax">
<b class="cmd">elementNodeCmd</b> <i class="m">?attributeName attributeValue ...? ?script?</i>
<b class="cmd">elementNodeCmd</b> <i class="m">?-attributeName attributeValue ...? ?script?</i>
<b class="cmd">elementNodeCmd</b> <i class="m">name_value_list script</i>
</pre>

................................................................................
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">setStoreLineColumn</b> <i class="m">?boolean</i>?</dt>
          <dd>If switched on, the DOM nodes will contain line and column
position information for the original XML document after parsing. The default
is not to store line and column position information.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">setNameCheck</b> <i class="m">?boolean</i>?</dt>
          <dd>If NameCheck is true, every method which expects an XML Name,
a full qualified name or a processing instructing target will check, if the
given string is valid according to its production rule. For commands created
with the <i class="m">createNodeCmd</i> method to be used in the context of
<i class="m">appendFromScript</i> the status of the flag at creation time
decides. If NameCheck is true at creation time, the command will
check its arguments, otherwise not. The <i class="m">setNameCheck</i>
set this flag. It returns the current NameCheck flag state. The
default state for NameCheck is true. </dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">setTextCheck</b> <i class="m">?boolean</i>?</dt>
          <dd>If TextCheck is true, every command which expects XML Chars,
a comment, a CDATA section value or a processing instructing value will check,
if the given string is valid according to its production rule. For commands
created with the <i class="m">createNodeCmd</i> method to be used in the
context of <i class="m">appendFromScript</i> the status of the flag at
creation time decides. If TextCheck is true at creation time, the
command will check its arguments, otherwise not.The
<i class="m">setTextCheck</i> method sets this flag. It returns the current
TextCheck flag state. The default state for TextCheck is true.</dd>
      

        
          <dt>
<b class="cmd">dom</b> <b class="method">setObjectCommands</b> ?<i class="m">(automatic|token|command)</i>?</dt>
          <dd>Controls if documents and nodes are created as tcl commands or
as token to be
used with the domNode and domDoc commands. If the mode is
'automatic', then methods used at tcl commands will create tcl
commands and methods used at doc or node tokes will create tokens. If
the mode is 'command' then always tcl commands will be created. If
the mode is 'token', then always token will be created. The method
returns the current mode. This method is an experimental interface.</dd>
      

        
          <dt>
<b class="cmd">dom</b> <b class="method">isName</b> <i class="m">name</i>
</dt>
          <dd>Returns 1 if <i class="m">name</i> is a valid XML Name according to
production 5 of the <a href="http://www.w3.org/TR/2004/REC-xml-20040204/#NT-NameChar">XML
            1.0</a> recommendation. This means that <i class="m">name</i> is a valid
          XML element or attribute name. Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isPIName</b> <i class="m">name</i>
</dt>
          <dd>Returns 1 if <i class="m">name</i> is a valid XML processing instruction
          target according to
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>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isNCName</b> <i class="m">name</i>
</dt>
          <dd>Returns 1 if <i class="m">name</i> is a valid NCName according
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
0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isQName</b> <i class="m">name</i>
</dt>
          <dd>Returns 1 if <i class="m">name</i> is a valid QName according
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
0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isCharData</b>
<i class="m">string</i>
</dt>
          <dd>Returns 1 if every character in <i class="m">string</i> is
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>
recommendation. Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isBMPCharData</b>
<i class="m">string</i>
</dt>
          <dd>Returns 1 if every character in <i class="m">string</i> is
a valid XML Char with a Unicode code point within the Basic
Multilingual Plane (that means, that every character within the string
is at most 3 bytes long). Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isComment</b>
<i class="m">string</i>
</dt>
          <dd>Returns 1 if <i class="m">string</i> is
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>
recommendation. Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isCDATA</b>
<i class="m">string</i>
</dt>
          <dd>Returns 1 if <i class="m">string</i> is
valid according to production 20 of the <a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XML 1.0</a>
recommendation. Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isPIValue</b>
<i class="m">string</i>
</dt>
          <dd>Returns 1 if <i class="m">string</i> is
valid according to production 16 of the <a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XML 1.0</a>
recommendation. Otherwise it returns 0.</dd>
        

        
            <dt>
<b class="cmd">dom</b> <b class="method">featureinfo</b> <i class="m">feature</i>
................................................................................
            build options and the expat version. The valid values for
            the <i class="m">feature</i> argument are:
            <dl class="optlist">
                
                    <dt><b>expatversion</b></dt>
                    <dd>Returns the version of the underlyling expat
                    version as string, something like
                    "exapt_2.1.0". This is what the expat API
                    function XML_ExpatVersion() returns.</dd>
                
                
                    <dt><b>expatmajorversion</b></dt>
                    <dd>Returns the major version of the underlyling
                    expat version as integer.</dd>
                
................................................................................
                
                    <dt><b>expatmicroversion</b></dt>
                    <dd>Returns the micro version of the underlyling
                    expat version as integer.</dd>
                
                
                    <dt><b>dtd</b></dt>
                    <dd>Returns as boolean if build with
                    <i class="m">--enable-dtd</i>.</dd>
                
                
                    <dt><b>ns</b></dt>
                    <dd>Returns as boolean if build with
                    <i class="m">--enable-ns</i>.</dd>
                
                
                    <dt><b>unknown</b></dt>
                    <dd>Returns as boolean if build with
                    <i class="m">--enable-unknown</i>.</dd>
                
                
                    <dt><b>tdomalloc</b></dt>
                    <dd>Returns as boolean if build with
                    <i class="m">--enable-tdomalloc</i>.</dd>
                
                
                    <dt><b>lessns</b></dt>
                    <dd>Returns as boolean if build with
                    <i class="m">--enable-lessns</i>.</dd>
                
                
                    <dt><b>TCL_UTF_MAX</b></dt>
                    <dd>Returns the TCL_UTF_MAX value of the tcl
                    core, tDOM was build with as integer</dd>
                
................................................................................
                    <i class="m">--enable-html5</i>.</dd>
                
            </dl>
            </dd>   
        
    </dl>

<h2><a name="SECTid0x1f86b10">KEYWORDS</a></h2><p class="keywords">
<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>
</p>
</div><hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</body>
</html>

Changes to doc/dom.n.

226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
...
279
280
281
282
283
284
285








286
287
288
289
290
291
292
293
294
295
296
297
298
299

300
301
302
303

304
305
306

307
308
309

310
311
312
313
314
315
316
317
318
319
320
321
322
...
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354

355
356
357

358

359
360

361
362

363
364
365
366
367
368
369
370
371
372
373
374
375
376
377

378
379
380
381
382
383
384
...
387
388
389
390
391
392
393
394
395
396
397


398

399
400
401
402
403

404
405

406
407
408
409
410
411
412
413
414
...
426
427
428
429
430
431
432
433
434
435
436
437
438
439









440
441
442
443
444
445
446
...
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
The valid options are:
.IP "\fB-simple\fR"
If \fI-simple\fR is
specified, a simple but fast parser is used (conforms not fully to XML
recommendation). That should double parsing and DOM generation speed. The
encoding of the data is not transformed inside the parser. The simple parser
does not respect any encoding information in the XML declaration. It skips over
the internal DTD subset and ignores any information in it. Therefor it doesn't
include defaulted attribute values into the tree, even if the according
attribute declaration is in the internal subset. It also doesn't expand
internal or external entity references other than the predefined entities and
character references.
.IP "\fB-html\fR"
If \fI-html\fR is specified, a fast HTML parser is
used, which tries to even parse badly formed HTML into a DOM tree.
.IP "\fB-html5\fR"
This option is only available, if tDOM was build
with --enable-html5. Try the \fIfeatureinfo\fR method
if you need to know, if this feature is build in. If
\&\fI-html5\fR is specified, the gumbo lib html5 parser
(https://github.com/google/gumbo-parser) is used, to
build the DOM tree. This is, as far as it goes, XML
namespace aware. Since this probably isn't wanted by a
lot of users and adds only burden for no good in a lot
of use cases \fI-html5\fR can be combined with
\&\fI-ignorexmlns\fR, in which case all nodes and
attributes in the DOM tree are not in an XML
namespace. All tag and attribute names in the DOM tree
will be lower case, even for foreign elements not in
the xhtml, svg or mathml namespace. The DOM tree may
include nodes, that the parser inserted, because they
are implied by the context (as <head>,
<tbody>, etc.).
.IP "\fB-json\fR"
If \fI-json\fR is specified, the \fIdata\fR is
expected to be a valid JSON string (according to RFC
7159). The command returns an ordinary DOM document
with nesting token inside the JSON data translated
................................................................................
from this JSON type information the returned doc
command or handle is an ordinary DOM doc, which may be
investigated or modified with the full range of the
doc and node methods. Please note that the element
node names and the text node values within the tree
may be outside of what the appropriate XML productions
allow.








.IP "\fB-keepEmpties\fR"
If \fI-keepEmpties\fR is
specified, text nodes, which contain only whitespaces, will be part of the
resulting DOM tree. In default case (\fI-keepEmpties\fR not given) those empty
text nodes are removed at parsing time.
.IP "\fB-channel  \fI<channel-ID>\fP\fR"
If \fI-channel <channel-ID>\fR is specified, the
input to be parsed is read from the specified channel. The encoding setting of
the channel (via fconfigure -encoding) is respected, ie the data read from the
channel are converted to UTF-8 according to the encoding settings, befor the
data is parsed.
.IP "\fB-baseurl  \fI<baseURI>\fP\fR"
If \fI-baseurl <baseURI>\fR is specified, the
baseURI is used as the base URI of the document. External entities referenced

in the document are resolved relative to this base URI. This base URI is also
stored within the DOM tree.
.IP "\fB-feedbackAfter  \fI<#bytes>\fP\fR"
If \fI-feedbackAfter <#bytes>\fR is specified, the

tcl command given by \fI-feedbackcmd\fR is evaluated at the first
element start within the document (or an external entity) after the
start of the document or external entity or the last such call after

#bytes.For backward compatibility, if no -feedbackcmd is given, but
there is a tcl proc named ::dom::domParseFeedback then this proc is
used as -feedbackcmd. If there isn't such a proc and -feedbackAfter is

used, it is an error to not also use -feedbackcmd. If the called
script raises error, then parsing will be aborted, the
\&\fIdom parse\fR call returns error, with the script
error msg as error msg. If the called script \fIreturn
-code break\fR, the parsing will abort and the \fIdom
parse\fR call will return the empty string.
.IP "\fB-feedbackcmd  \fI<script>\fP\fR"
If \fI-feedbackcmd <script>\fR is specified, the
script \fIscript\fR is evaluated at the first
element start within the document (or an external entity) after the
start of the document or external entity or the last such call after
#bytes value given by the \fI-feedbackAfter\fR option. If
\&\fI-feedbackAfter\fR isn't given, using this option
................................................................................
.IP "\fB-externalentitycommand  \fI<script>\fP\fR"
If \fI-externalentitycommand <script>\fR is
specified, the specified tcl script is called to resolve any external entities
of the document. The actual evaluated command consists of this option followed
by three arguments: the base uri, the system identifier of the entity and the
public identifier of the entity. The base uri and the public identifier may be
the empty list. The script has to return a tcl list consisting of three
elements. The first element of this list signals, how the external entity is
returned to the processor. At the moment, the two allowed types are "string"
and "channel". The second element of the list has to be the (absolute) base URI
of the external entity to be parsed.  The third element of the list are data,
either the already read data out of the external entity as string in the case
of type "string", or the name of a tcl channel, in the case of type
"channel". Note that if the script returns a tcl channel, it will not be closed
by the processor.  It must be closed separately if it is no longer
required.
.IP "\fB-useForeignDTD  \fI<boolean>\fP\fR"
If <boolean> is true and the document does not have
an external subset, the parser will call the -externalentitycommand script with
empty values for the systemId and publicID arguments. Pleace notice, that, if
the document also doesn't have an internal subset, the
-startdoctypedeclcommand and -enddoctypedeclcommand scripts, if set, are not
called. The \fI-useForeignDTD\fR respects
.IP "\fB-paramentityparsing  \fI<always|never|notstandalone>\fP\fR"
The \fI-paramentityparsing\fR option controls, if the
parser tries to resolve the external entities (including the external DTD

subset) of the document, while building the DOM
tree. \fI-paramentityparsing\fR requires an argument, which must be either
"always", "never", or "notstandalone". The value "always" means, that the

parser tries to resolves (recursively) all external entities of the XML

source. This is the default, in case \fI-paramentityparsing\fR is omitted. The
value "never" means, that only the given XML source is parsed and no external

entity (including the external subset) will be resolved and parsed. The value
"notstandalone" means, that all external entities will be resolved and parsed,

with the execption of documents, which explicitly states standalone="yes" in
their XML declaration.
.IP "\fB-ignorexmlns\fR"
It is recommended, that you only use this option
together with the \fI-html5\fR option, if ever. If
this option is given, no node within the created DOM
tree will be internally marked as placed into an XML
Namespace, even if there is a default namespace in
scope for un-prefixed elements or even if the element
has a defined namespace prefix. One consequence is of
this is, that XPath node expressions on such a DOM
tree doesn't work as expected. Prefixed element nodes
can't be selected and element nodes without prefix
will be seen by XPath expressions as if they haven't
any namespace (no matter if they in fact in a default

namespace).
.PP
.RE
.TP
\&\fB\fBdom\fP \fBcreateDocument\fP \fIdocElemName\fB ?\fIobjVar\fB?
\&\fRCreates a new DOM document object with one element node with
node name \fIdocElemName\fR. The \fIobjVar\fR controls the
................................................................................
\&\fB\fBdom\fP \fBcreateDocumentNS\fP \fIuri\fB \fIdocElemName\fB ?\fIobjVar\fB?
\&\fRCreates a new DOM document object with one element node with
node name \fIdocElemName\fR. \fIUri\fR gives the namespace of the
document element to create. The \fIobjVar\fR controls the
memory handling as explained above.
.TP
\&\fB\fBdom\fP \fBcreateDocumentNode\fP ?\fIobjVar\fB?
\&\fRCreates a new, 'empty' DOM document object without any element
node. \fIobjVar\fR controls the memory handling as explained above.
.TP
\&\fB\fBdom\fP \fBsetResultEncoding\fP ?\fIencodingName\fB?


\&\fRIf \fIencodingName\fR is not given the current global

result encoding is returned.  Otherwise the global result encoding is set to
\&\fIencodingName\fR.  All character data, attribute values, etc. will
then be converted from UTF-8, which is delivered from the Expat XML parser, to
the given 8 bit encoding at XML/DOM parse time.  Valid values for
\&\fIencodingName\fR are: utf-8, ascii, cp1250, cp1251, cp1252, cp1253,

cp1254, cp1255, cp1256, cp437, cp850, en, iso8859-1, iso8859-2, iso8859-3,
iso8859-4, iso8859-5, iso8859-6, iso8859-7, iso8859-8, iso8859-9, koi8-r.

.TP
\&\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
\&\fRThis method creates Tcl commands, which in turn create
tDOM nodes. Tcl commands created by this command are only
avaliable inside a script given to the domNode methods
\&\fIappendFromScript\fR or \fIinsertBeforeFromScript\fR. If
a command created with \fIcreateNodeCmd\fR is invoked in
any other context, it will return error. The created command
\&\fIcommandName\fR replaces any existing command or
................................................................................
option \fI-returnNodeCmd\fR was given, the command returns the
created node as Tcl command. If this option was omitted, the command
returns nothing. Each command creates always the same type of node.
Which type of node is created by the command is determined by the
first argument to the \fIcreateNodeCmd\fR. The syntax of the created
command depends on the type of the node it creates.
.PP
If the first argument of the method is \fIelementNode\fR, the
created command will create an element node. Without the
\&\fI-tagName\fR option the tag name of the created node is
\&\fIcommandName\fR without namespace qualifiers. If the
\&\fI-tagName\fR option was given then the created command the created
elements will have this tag name. If the \fI-jsonType\fR option was
given then the created node elements will have the given JSON type.









The syntax of the created command is:



.CS

\&\fBelementNodeCmd\fP \fI?attributeName attributeValue ...? ?script?\fR
................................................................................

.CE
.RE
.TP
\&\fB\fBdom\fP \fBsetStoreLineColumn\fP \fI?boolean\fB?
\&\fRIf switched on, the DOM nodes will contain line and column
position information for the original XML document after parsing. The default
is, not to store line and column position information.
.TP
\&\fB\fBdom\fP \fBsetNameCheck\fP \fI?boolean\fB?
\&\fRIf NameCheck is true, every method which expects an XML Name,
a full qualified name or a processing instructing target will check, if the
given string is valid according to his production rule. For commands created
with the \fIcreateNodeCmd\fR method to be used in the context of
\&\fIappendFromScript\fR the status of the flag at creation time
decides. If NameCheck is true at creation time, the command will
check his arguments, otherwise not. The \fIsetNameCheck\fR
set this flag. It returns the current NameCheck flag state. The
default state for NameCheck is true.
.TP
\&\fB\fBdom\fP \fBsetTextCheck\fP \fI?boolean\fB?
\&\fRIf TextCheck is true, every command which expects XML Chars,
a comment, a CDATA section value or a processing instructing value will check,
if the given string is valid according to his production rule. For commands
created with the \fIcreateNodeCmd\fR method to be used in the
context of \fIappendFromScript\fR the status of the flag at
creation time decides. If TextCheck is true at creation time, the
command will check his arguments, otherwise not.The
\&\fIsetTextCheck\fR method set this flag. It returns the current
TextCheck flag state. The default state for TextCheck is true.
.TP
\&\fB\fBdom\fP \fBsetObjectCommands\fP ?\fI(automatic|token|command)\fB?
\&\fRControls, if documents and nodes are created as tcl commands or
as token to be
used with the domNode and domDoc commands. If the mode is
\&'automatic', then methods used at tcl commands will create tcl
commands and methods used at doc or node tokes will create tokens. If
the mode is 'command' then always tcl commands will be created. If
the mode is 'token', then always token will be created. The method
returns the current mode. This method is an experimental interface.
.TP
\&\fB\fBdom\fP \fBisName\fP \fIname\fB
\&\fRReturns 1, if \fIname\fR is a valid XML Name according to
production 5 of the XML
1.0 recommendation. This means, that \fIname\fR is a valid
XML element or attribute name. Otherwise it returns 0.
.TP
\&\fB\fBdom\fP \fBisPIName\fP \fIname\fB
\&\fRReturns 1, if \fIname\fR is a valid XML processing instruction
target according to
production 17 of the XML 1.0 recommendation. Otherwise it returns 0.
.TP
\&\fB\fBdom\fP \fBisNCName\fP \fIname\fB
\&\fRReturns 1, if \fIname\fR is a valid NCName according
to production 4 of the of the Namespaces in XML recommendation. Otherwise it returns
0.
.TP
\&\fB\fBdom\fP \fBisQName\fP \fIname\fB
\&\fRReturns 1, if \fIname\fR is a valid QName according
to production 6 of the of the Namespaces in XML recommendation. Otherwise it returns
0.
.TP
\&\fB\fBdom\fP \fBisCharData\fP \fIstring\fB
\&\fRReturns 1, if every character in \fIstring\fR is
a valid XML Char according to production 2 of the XML 1.0
recommendation. Otherwise it returns 0.
.TP
\&\fB\fBdom\fP \fBisBMPCharData\fP \fIstring\fB
\&\fRReturns 1, if every character in \fIstring\fR is
a valid XML Char with a Unicode code point within the Basic
Multilingual Plane (that means, that every character within the string
is at most 3 bytes long). Otherwise it returns 0.
.TP
\&\fB\fBdom\fP \fBisComment\fP \fIstring\fB
\&\fRReturns 1, if \fIstring\fR is
a valid comment according to production 15 of the XML 1.0
recommendation. Otherwise it returns 0.
.TP
\&\fB\fBdom\fP \fBisCDATA\fP \fIstring\fB
\&\fRReturns 1, if \fIstring\fR is
valid according to production 20 of the XML 1.0
recommendation. Otherwise it returns 0.
.TP
\&\fB\fBdom\fP \fBisPIValue\fP \fIstring\fB
\&\fRReturns 1, if \fIstring\fR is
valid according to production 16 of the XML 1.0
recommendation. Otherwise it returns 0.
.TP
\&\fB\fBdom\fP \fBfeatureinfo\fP \fIfeature\fB
\&\fRThis method provides information about the used
build options and the expat version. The valid values for
the \fIfeature\fR argument are:
.RS
.IP "\fBexpatversion\fR"
Returns the version of the underlyling expat
version as string, something like
"exapt_2.1.0". This is. what the expat API
function XML_ExpatVersion() returns.
.IP "\fBexpatmajorversion\fR"
Returns the major version of the underlyling
expat version as integer.
.IP "\fBexpatminorversion\fR"
Returns the minor version of the underlyling
expat version as integer.
.IP "\fBexpatmicroversion\fR"
Returns the micro version of the underlyling
expat version as integer.
.IP "\fBdtd\fR"
Returns as boolean, if build with
\&\fI--enable-dtd\fR.
.IP "\fBns\fR"
Returns as boolean, if build with
\&\fI--enable-ns\fR.
.IP "\fBunknown\fR"
Returns as boolean, if build with
\&\fI--enable-unknown\fR.
.IP "\fBtdomalloc\fR"
Returns as boolean, if build with
\&\fI--enable-tdomalloc\fR.
.IP "\fBlessns\fR"
Returns as boolean, if build with
\&\fI--enable-lessns\fR.
.IP "\fBTCL_UTF_MAX\fR"
Returns the TCL_UTF_MAX value of the tcl
core, tDOM was build with as integer
.IP "\fBhtml5\fR"
Returns as boolean, if build with
\&\fI--enable-html5\fR.
.RE
.SH KEYWORDS
XML, DOM, document, node, parsing







|








|

|

|

|







|







 







>
>
>
>
>
>
>
>


|






|


|
|
>
|
|

|
>
|
|
|
>
|
|
|
>
|
|
|
|
|
|







 







|
|






|



|




|
|
>
|
|
|
>
|
>
|
|
>
|
|
>
|



|
|
|
|
|
|
|
|
|
|
<
>







 







|



>
>
|
>
|
|
|
|
|
>
|
|
>

|







 







|
|




|
>
>
>
>
>
>
>
>
>







 







|




|



|






|



|
|



|









|

|



|




|




|




|




|





|




|




|











|











|


|


|


|


|










226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
...
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
...
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393

394
395
396
397
398
399
400
401
...
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
...
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
...
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
The valid options are:
.IP "\fB-simple\fR"
If \fI-simple\fR is
specified, a simple but fast parser is used (conforms not fully to XML
recommendation). That should double parsing and DOM generation speed. The
encoding of the data is not transformed inside the parser. The simple parser
does not respect any encoding information in the XML declaration. It skips over
the internal DTD subset and ignores any information in it. Therefore it doesn't
include defaulted attribute values into the tree, even if the according
attribute declaration is in the internal subset. It also doesn't expand
internal or external entity references other than the predefined entities and
character references.
.IP "\fB-html\fR"
If \fI-html\fR is specified, a fast HTML parser is
used, which tries to even parse badly formed HTML into a DOM tree.
.IP "\fB-html5\fR"
This option is only available if tDOM was build
with --enable-html5. Try the \fIfeatureinfo\fR method
if you need to know if this feature is build in. If
\&\fI-html5\fR is specified, the gumbo lib html5 parser
(https://github.com/google/gumbo-parser) is used to
build the DOM tree. This is, as far as it goes, XML
namespace-aware. Since this probably isn't wanted by a
lot of users and adds only burden for no good in a lot
of use cases \fI-html5\fR can be combined with
\&\fI-ignorexmlns\fR, in which case all nodes and
attributes in the DOM tree are not in an XML
namespace. All tag and attribute names in the DOM tree
will be lower case, even for foreign elements not in
the xhtml, svg or mathml namespace. The DOM tree may
include nodes, that the parser inserted because they
are implied by the context (as <head>,
<tbody>, etc.).
.IP "\fB-json\fR"
If \fI-json\fR is specified, the \fIdata\fR is
expected to be a valid JSON string (according to RFC
7159). The command returns an ordinary DOM document
with nesting token inside the JSON data translated
................................................................................
from this JSON type information the returned doc
command or handle is an ordinary DOM doc, which may be
investigated or modified with the full range of the
doc and node methods. Please note that the element
node names and the text node values within the tree
may be outside of what the appropriate XML productions
allow.
.IP "\fB-jsonmaxnesting  \fIinteger\fP\fR"
This options only has effect if used together
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.
.IP "\fB--\fR"
The option \fI--\fR marks the end of options.
While respected in general this option is only needed
in case of parsing JSON data, which may start with a
"-".
.IP "\fB-keepEmpties\fR"
If \fI-keepEmpties\fR is
specified then text nodes which contain only whitespaces will be part of the
resulting DOM tree. In default case (\fI-keepEmpties\fR not given) those empty
text nodes are removed at parsing time.
.IP "\fB-channel  \fI<channel-ID>\fP\fR"
If \fI-channel <channel-ID>\fR is specified, the
input to be parsed is read from the specified channel. The encoding setting of
the channel (via fconfigure -encoding) is respected, ie the data read from the
channel are converted to UTF-8 according to the encoding settings before the
data is parsed.
.IP "\fB-baseurl  \fI<baseURI>\fP\fR"
If \fI-baseurl <baseURI>\fR is specified,
the baseURI is used as the base URI of the document.
External entities references in the document are
resolved relative to this base URI. This base URI is
also stored within the DOM tree.
.IP "\fB-feedbackAfter  \fI<#bytes>\fP\fR"
If \fI-feedbackAfter <#bytes>\fR is
specified, the tcl command given by
\&\fI-feedbackcmd\fR is evaluated at the first element
start within the document (or an external entity)
after the start of the document or external entity or
the last such call after #bytes. For backward
compatibility if no -feedbackcmd is given but there is
a tcl proc named ::dom::domParseFeedback this proc is
used as -feedbackcmd. If there isn't such a proc and
-feedbackAfter is used it is an error to not also use
-feedbackcmd. If the called script raises error, then
parsing will be aborted, the \fIdom parse\fR call
returns error, with the script error msg as error msg.
If the called script \fIreturn -code break\fR, the
parsing will abort and the \fIdom parse\fR call will
return the empty string.
.IP "\fB-feedbackcmd  \fI<script>\fP\fR"
If \fI-feedbackcmd <script>\fR is specified, the
script \fIscript\fR is evaluated at the first
element start within the document (or an external entity) after the
start of the document or external entity or the last such call after
#bytes value given by the \fI-feedbackAfter\fR option. If
\&\fI-feedbackAfter\fR isn't given, using this option
................................................................................
.IP "\fB-externalentitycommand  \fI<script>\fP\fR"
If \fI-externalentitycommand <script>\fR is
specified, the specified tcl script is called to resolve any external entities
of the document. The actual evaluated command consists of this option followed
by three arguments: the base uri, the system identifier of the entity and the
public identifier of the entity. The base uri and the public identifier may be
the empty list. The script has to return a tcl list consisting of three
elements. The first element of this list signals how the external entity is
returned to the processor. Currently the two allowed types are "string"
and "channel". The second element of the list has to be the (absolute) base URI
of the external entity to be parsed.  The third element of the list are data,
either the already read data out of the external entity as string in the case
of type "string", or the name of a tcl channel, in the case of type
"channel". Note that if the script returns a tcl channel, it will not be closed
by the processor.  It must be closed separately if it is no longer
needed.
.IP "\fB-useForeignDTD  \fI<boolean>\fP\fR"
If <boolean> is true and the document does not have
an external subset, the parser will call the -externalentitycommand script with
empty values for the systemId and publicID arguments. Please note that if
the document also doesn't have an internal subset, the
-startdoctypedeclcommand and -enddoctypedeclcommand scripts, if set, are not
called. The \fI-useForeignDTD\fR respects
.IP "\fB-paramentityparsing  \fI<always|never|notstandalone>\fP\fR"
The \fI-paramentityparsing\fR option controls,
if the parser tries to resolve the external entities
(including the external DTD subset) of the document
while building the DOM tree.
\&\fI-paramentityparsing\fR requires an argument, which
must be either "always", "never", or "notstandalone".
The value "always" means that the parser tries to
resolves (recursively) all external entities of the
XML source. This is the default in case
\&\fI-paramentityparsing\fR is omitted. The value
"never" means that only the given XML source is
parsed and no external entity (including the external
subset) will be resolved and parsed. The value
"notstandalone" means, that all external entities will
be resolved and parsed, with the execption of
documents, which explicitly states standalone="yes" in
their XML declaration.
.IP "\fB-ignorexmlns\fR"
It is recommended, that you only use this option
with the \fI-html5\fR option. If this option is
given, no node within the created DOM tree will be
internally marked as placed into an XML Namespace,
even if there is a default namespace in scope for
un-prefixed elements or even if the element has a
defined namespace prefix. One consequence is that
XPath node expressions on such a DOM tree doesn't work
as expected. Prefixed element nodes can't be selected
and element nodes without prefix will be seen by XPath
expressions as if they are not in any namespace (no

matter if they are in fact should be in a default
namespace).
.PP
.RE
.TP
\&\fB\fBdom\fP \fBcreateDocument\fP \fIdocElemName\fB ?\fIobjVar\fB?
\&\fRCreates a new DOM document object with one element node with
node name \fIdocElemName\fR. The \fIobjVar\fR controls the
................................................................................
\&\fB\fBdom\fP \fBcreateDocumentNS\fP \fIuri\fB \fIdocElemName\fB ?\fIobjVar\fB?
\&\fRCreates a new DOM document object with one element node with
node name \fIdocElemName\fR. \fIUri\fR gives the namespace of the
document element to create. The \fIobjVar\fR controls the
memory handling as explained above.
.TP
\&\fB\fBdom\fP \fBcreateDocumentNode\fP ?\fIobjVar\fB?
\&\fRCreates a new 'empty' DOM document object without any element
node. \fIobjVar\fR controls the memory handling as explained above.
.TP
\&\fB\fBdom\fP \fBsetResultEncoding\fP ?\fIencodingName\fB?
\&\fRThis option is for backward compatibility with Tcl
8.0. If tDOM is build with any newer Tcl version this option
does not has any effect. If \fIencodingName\fR is not given
the current global result encoding is returned. Otherwise
the global result encoding is set to \fIencodingName\fR.
All character data, attribute values etc. will then be
converted from UTF-8, which is delivered from the Expat XML
parser, to the given 8 bit encoding at XML/DOM parse time.
Valid values for \fIencodingName\fR are: utf-8, ascii,
cp1250, cp1251, cp1252, cp1253, cp1254, cp1255, cp1256,
cp437, cp850, en, iso8859-1, iso8859-2, iso8859-3,
iso8859-4, iso8859-5, iso8859-6, iso8859-7, iso8859-8,
iso8859-9, koi8-r.
.TP
\&\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
\&\fRThis method creates Tcl commands, which in turn create
tDOM nodes. Tcl commands created by this command are only
avaliable inside a script given to the domNode methods
\&\fIappendFromScript\fR or \fIinsertBeforeFromScript\fR. If
a command created with \fIcreateNodeCmd\fR is invoked in
any other context, it will return error. The created command
\&\fIcommandName\fR replaces any existing command or
................................................................................
option \fI-returnNodeCmd\fR was given, the command returns the
created node as Tcl command. If this option was omitted, the command
returns nothing. Each command creates always the same type of node.
Which type of node is created by the command is determined by the
first argument to the \fIcreateNodeCmd\fR. The syntax of the created
command depends on the type of the node it creates.
.PP
If the command type to create is \fIelementNode\fR, the created
command will create an element node, if called. Without the
\&\fI-tagName\fR option the tag name of the created node is
\&\fIcommandName\fR without namespace qualifiers. If the
\&\fI-tagName\fR option was given then the created command the created
elements will have this tag name. If the \fI-jsonType\fR option was
given then the created node elements will have the given JSON type. If
the \fI-namespace\fR option is given the created element node will be
XML namespaced and in the namespace given by the option. The element
name will be literal as given either by the command name or the
\&\fI-tagname\fR option, if that was given. An appropriate XML
namespace declaration will be automatically added, to bind the prefix
(if the element name has one) or the default namespace (if the element
name hasn't a prefix) to the namespace if such a binding isn't in
scope.
.PP
The syntax of the created command is:



.CS

\&\fBelementNodeCmd\fP \fI?attributeName attributeValue ...? ?script?\fR
................................................................................

.CE
.RE
.TP
\&\fB\fBdom\fP \fBsetStoreLineColumn\fP \fI?boolean\fB?
\&\fRIf switched on, the DOM nodes will contain line and column
position information for the original XML document after parsing. The default
is not to store line and column position information.
.TP
\&\fB\fBdom\fP \fBsetNameCheck\fP \fI?boolean\fB?
\&\fRIf NameCheck is true, every method which expects an XML Name,
a full qualified name or a processing instructing target will check, if the
given string is valid according to its production rule. For commands created
with the \fIcreateNodeCmd\fR method to be used in the context of
\&\fIappendFromScript\fR the status of the flag at creation time
decides. If NameCheck is true at creation time, the command will
check its arguments, otherwise not. The \fIsetNameCheck\fR
set this flag. It returns the current NameCheck flag state. The
default state for NameCheck is true.
.TP
\&\fB\fBdom\fP \fBsetTextCheck\fP \fI?boolean\fB?
\&\fRIf TextCheck is true, every command which expects XML Chars,
a comment, a CDATA section value or a processing instructing value will check,
if the given string is valid according to its production rule. For commands
created with the \fIcreateNodeCmd\fR method to be used in the
context of \fIappendFromScript\fR the status of the flag at
creation time decides. If TextCheck is true at creation time, the
command will check its arguments, otherwise not.The
\&\fIsetTextCheck\fR method sets this flag. It returns the current
TextCheck flag state. The default state for TextCheck is true.
.TP
\&\fB\fBdom\fP \fBsetObjectCommands\fP ?\fI(automatic|token|command)\fB?
\&\fRControls if documents and nodes are created as tcl commands or
as token to be
used with the domNode and domDoc commands. If the mode is
\&'automatic', then methods used at tcl commands will create tcl
commands and methods used at doc or node tokes will create tokens. If
the mode is 'command' then always tcl commands will be created. If
the mode is 'token', then always token will be created. The method
returns the current mode. This method is an experimental interface.
.TP
\&\fB\fBdom\fP \fBisName\fP \fIname\fB
\&\fRReturns 1 if \fIname\fR is a valid XML Name according to
production 5 of the XML
1.0 recommendation. This means that \fIname\fR is a valid
XML element or attribute name. Otherwise it returns 0.
.TP
\&\fB\fBdom\fP \fBisPIName\fP \fIname\fB
\&\fRReturns 1 if \fIname\fR is a valid XML processing instruction
target according to
production 17 of the XML 1.0 recommendation. Otherwise it returns 0.
.TP
\&\fB\fBdom\fP \fBisNCName\fP \fIname\fB
\&\fRReturns 1 if \fIname\fR is a valid NCName according
to production 4 of the of the Namespaces in XML recommendation. Otherwise it returns
0.
.TP
\&\fB\fBdom\fP \fBisQName\fP \fIname\fB
\&\fRReturns 1 if \fIname\fR is a valid QName according
to production 6 of the of the Namespaces in XML recommendation. Otherwise it returns
0.
.TP
\&\fB\fBdom\fP \fBisCharData\fP \fIstring\fB
\&\fRReturns 1 if every character in \fIstring\fR is
a valid XML Char according to production 2 of the XML 1.0
recommendation. Otherwise it returns 0.
.TP
\&\fB\fBdom\fP \fBisBMPCharData\fP \fIstring\fB
\&\fRReturns 1 if every character in \fIstring\fR is
a valid XML Char with a Unicode code point within the Basic
Multilingual Plane (that means, that every character within the string
is at most 3 bytes long). Otherwise it returns 0.
.TP
\&\fB\fBdom\fP \fBisComment\fP \fIstring\fB
\&\fRReturns 1 if \fIstring\fR is
a valid comment according to production 15 of the XML 1.0
recommendation. Otherwise it returns 0.
.TP
\&\fB\fBdom\fP \fBisCDATA\fP \fIstring\fB
\&\fRReturns 1 if \fIstring\fR is
valid according to production 20 of the XML 1.0
recommendation. Otherwise it returns 0.
.TP
\&\fB\fBdom\fP \fBisPIValue\fP \fIstring\fB
\&\fRReturns 1 if \fIstring\fR is
valid according to production 16 of the XML 1.0
recommendation. Otherwise it returns 0.
.TP
\&\fB\fBdom\fP \fBfeatureinfo\fP \fIfeature\fB
\&\fRThis method provides information about the used
build options and the expat version. The valid values for
the \fIfeature\fR argument are:
.RS
.IP "\fBexpatversion\fR"
Returns the version of the underlyling expat
version as string, something like
"exapt_2.1.0". This is what the expat API
function XML_ExpatVersion() returns.
.IP "\fBexpatmajorversion\fR"
Returns the major version of the underlyling
expat version as integer.
.IP "\fBexpatminorversion\fR"
Returns the minor version of the underlyling
expat version as integer.
.IP "\fBexpatmicroversion\fR"
Returns the micro version of the underlyling
expat version as integer.
.IP "\fBdtd\fR"
Returns as boolean if build with
\&\fI--enable-dtd\fR.
.IP "\fBns\fR"
Returns as boolean if build with
\&\fI--enable-ns\fR.
.IP "\fBunknown\fR"
Returns as boolean if build with
\&\fI--enable-unknown\fR.
.IP "\fBtdomalloc\fR"
Returns as boolean if build with
\&\fI--enable-tdomalloc\fR.
.IP "\fBlessns\fR"
Returns as boolean if build with
\&\fI--enable-lessns\fR.
.IP "\fBTCL_UTF_MAX\fR"
Returns the TCL_UTF_MAX value of the tcl
core, tDOM was build with as integer
.IP "\fBhtml5\fR"
Returns as boolean, if build with
\&\fI--enable-html5\fR.
.RE
.SH KEYWORDS
XML, DOM, document, node, parsing

Changes to doc/dom.xml.

329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
...
354
355
356
357
358
359
360
361
362
363
364
365
366
367









368
369
370
371
372
373
374
375
          cp437, cp850, en, iso8859-1, iso8859-2, iso8859-3,
          iso8859-4, iso8859-5, iso8859-6, iso8859-7, iso8859-8,
          iso8859-9, koi8-r.</desc>
        </commanddef>

        <commanddef>
          <command><cmd>dom</cmd> <method>createNodeCmd</method>
<m>?-returnNodeCmd?</m> <m>?-tagName name?</m> <m>?-jsonType jsonType</m> <m>(element|comment|text|cdata|pi)Node</m> <m>commandName</m></command>
          <desc>This method creates Tcl commands, which in turn create
          tDOM nodes. Tcl commands created by this command are only
          avaliable inside a script given to the domNode methods
          <m>appendFromScript</m> or <m>insertBeforeFromScript</m>. If
          a command created with <m>createNodeCmd</m> is invoked in
          any other context, it will return error. The created command
          <m>commandName</m> replaces any existing command or
................................................................................
option <m>-returnNodeCmd</m> was given, the command returns the
created node as Tcl command. If this option was omitted, the command
returns nothing. Each command creates always the same type of node.
Which type of node is created by the command is determined by the
first argument to the <m>createNodeCmd</m>. The syntax of the created
command depends on the type of the node it creates.</p>

<p>If the first argument of the method is <m>elementNode</m>, the
created command will create an element node, if called. Without the
<m>-tagName</m> option the tag name of the created node is
<m>commandName</m> without namespace qualifiers. If the
<m>-tagName</m> option was given then the created command the created
elements will have this tag name. If the <m>-jsonType</m> option was
given then the created node elements will have the given JSON type.









The syntax of the created command is:</p>

<syntax>
<cmd>elementNodeCmd</cmd> <m>?attributeName attributeValue ...? ?script?</m>
<cmd>elementNodeCmd</cmd> <m>?-attributeName attributeValue ...? ?script?</m>
<cmd>elementNodeCmd</cmd> <m>name_value_list script</m>
</syntax>








|







 







|
|




|
>
>
>
>
>
>
>
>
>
|







329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
...
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
          cp437, cp850, en, iso8859-1, iso8859-2, iso8859-3,
          iso8859-4, iso8859-5, iso8859-6, iso8859-7, iso8859-8,
          iso8859-9, koi8-r.</desc>
        </commanddef>

        <commanddef>
          <command><cmd>dom</cmd> <method>createNodeCmd</method>
<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>
          <desc>This method creates Tcl commands, which in turn create
          tDOM nodes. Tcl commands created by this command are only
          avaliable inside a script given to the domNode methods
          <m>appendFromScript</m> or <m>insertBeforeFromScript</m>. If
          a command created with <m>createNodeCmd</m> is invoked in
          any other context, it will return error. The created command
          <m>commandName</m> replaces any existing command or
................................................................................
option <m>-returnNodeCmd</m> was given, the command returns the
created node as Tcl command. If this option was omitted, the command
returns nothing. Each command creates always the same type of node.
Which type of node is created by the command is determined by the
first argument to the <m>createNodeCmd</m>. The syntax of the created
command depends on the type of the node it creates.</p>

<p>If the command type to create is <m>elementNode</m>, the created
command will create an element node, if called. Without the
<m>-tagName</m> option the tag name of the created node is
<m>commandName</m> without namespace qualifiers. If the
<m>-tagName</m> option was given then the created command the created
elements will have this tag name. If the <m>-jsonType</m> option was
given then the created node elements will have the given JSON type. If
the <m>-namespace</m> option is given the created element node will be
XML namespaced and in the namespace given by the option. The element
name will be literal as given either by the command name or the
<m>-tagname</m> option, if that was given. An appropriate XML
namespace declaration will be automatically added, to bind the prefix
(if the element name has one) or the default namespace (if the element
name hasn't a prefix) to the namespace if such a binding isn't in
scope.</p>

<p>The syntax of the created command is:</p>

<syntax>
<cmd>elementNodeCmd</cmd> <m>?attributeName attributeValue ...? ?script?</m>
<cmd>elementNodeCmd</cmd> <m>?-attributeName attributeValue ...? ?script?</m>
<cmd>elementNodeCmd</cmd> <m>name_value_list script</m>
</syntax>

Changes to doc/domDoc.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
...
156
157
158
159
160
161
162
163
164

165
166
167
168
169
170
171
172

173
174
175
176

177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
...
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335

336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
...
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
...
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
...
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
...
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
...
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
<html>
<head>
<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 $">
</head><body>
<div class="header">
<div class="navbar" align="center">
<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>
</div><hr class="navsep">
</div><div class="body">
  <h2><a name="SECTid0xa2ebe0">NAME</a></h2><p class="namesection">
<b class="names">domDoc - </b><br>Manipulates an instance of a DOM document object</p>
  
  <h2><a name="SECTid0xa4db80">SYNOPSIS</a></h2><pre class="syntax">domDocObjCmd <i class="m">method</i> ?<i class="m">arg arg ...</i>?</pre>

  <h2><a name="SECTid0xad8760">DESCRIPTION </a></h2><p>This command manipulates one particular instance of a document
object. <i class="m">method</i> indicates a specific method of the document class. These
methods should closely conform to the W3C recommendation "Document Object Model
(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
at these documents for a deeper understanding of the functionality.</p><p>The valid methods are:</p><dl class="commandlist">
        
          <dt>
<b class="method">documentElement</b> ?<i class="m">objVar</i>?</dt>
................................................................................
        channelId.</p>

        <p>If the option <i class="m">-escapeNonASCII</i> is given,
        every non 7 bit ASCII character in attribute values or element
        PCDATA content will be escaped as character reference in
        decimal representation.</p>

        <p>The flag <i class="m">-doctypeDeclaration</i>
        determines, whether there will be a DOCTYPE declaration
        emitted before the first node of the document. The default is,
        to do not. The DOCTYPE name will always be the element name of
        the document element. An external entity declaration of the
        external subset is only emitted, if the document has a system
        identifier.</p>

        <p>The flag <i class="m">-xmlDeclaration</i> determines, whether there
        will be an XML Declaration and a newline emitted before
        anything else. The default is, to do not. If this flag is
        given with a true argument then</p>

        <p>
<i class="m">-encString</i> sets the encoding value in the XML
        Declaration. Otherwise, this option is ignored. Please note,
        that this option just enhance the string representation of the
        generated XML Declaration with an encoding information string,
        nothing more. It's up to the user to handle encoding in case
        of writing to a channel or reparsing.</p>
            
        <p>If the option <i class="m">-escapeAllQuot</i> is given,
        quotation marks will be escaped with &amp;quot; even in text
        content of elements.</p>
................................................................................
      

      
        <dt>
<b class="method">asHTML</b> <b class="option">?-channel
channelId?</b> <b class="option">?-escapeNonASCII?</b> <b class="option">?-htmlEntities?</b> <b class="option">?-doctypeDeclaration &lt;boolean&gt;?</b>
</dt> 
        <dd>Returns the DOM tree serialized acording to HTML rules (HTML
elements are recognized regardless of case, without end tags for emtpy HTML

elements etc.), as string or sends the output directly to the given
channelId. If the option <i class="m">-escapeNonASCII</i> is given, every non 7 bit ASCII
character in attribute values or element PCDATA content will be escaped as
character reference in decimal representation. If the option
<i class="m">-htmlEntities</i> is given, a character is outputed using a HTML 4.01
character entity reference, if one is defined for it. The flag
<i class="m">-doctypeDeclaration</i> determines, whether there will be a DOCTYPE
declaration emitted before the first node of the document. The default is, to

do not. The DOCTYPE name will always be the element name of the document
element without case normalization. An external entity declaration of the
external subset is only emitted, if the document has a system identifier. The
doctype declaration will be written from the avaliable informations, without

check, if this is a known (w3c) HTML version information or if the document
confirms to the given HTML version.</dd>
      

      
        <dt><b class="method">asText</b></dt>
          <dd>The asText method outputs the result tree by outputting
the string-value of every text node in the result tree in document
order without any escaping. In effect, this is what the xslt output method
"text" (XSLT 1.0 recommendation, section 16.3) does.</dd>
      

      
        <dt>
<b class="method">asJSON</b> <b class="option">?-indent none/0..8?</b> <b class="option">?-channel channelId?</b>
</dt>
          <dd>
<p>The asJSON method serializes the tree into a valid
          JSON data string. In general this may be a lossy
          serialization. For this serialization all comment, character
          data sections and processing instruction nodes, all
          attributes and all XML namespaces are ignored. Only element
          and text nodes may be reflected in the generated JSON
          serialization. Appropriate JSON data type information of a
          node will be respected.</p>

          <p>If an element node has the JSON type OBJECT then every
          element node child of this element will be serializend as
          member of that object, with the node name of the child as
          the member name and the relevant childs of that child as the
          value. Every other child nodes will be ignored.</p>

          <p>If an element node has the JSON type ARRAY then the text
          and element node childs of that element node are serialized
          as the consecutive values of the array. Element node childs
          of an ARRAY element will be container nodes for nested ARRAY
          or OBJECT values.</p>

          <p>Text nodes with the JSON types TRUE, FALSE or NULL will
          be serialized to the corresponding JSON token without
          looking at the value of the text node. A text node without
          JSON type will always be serialized as a JSON string token.
          A text node with JSON type NUMBER will be serialized as JSON
          number token if the text node value is in fact a valid JSON
          number and as a JSON string if not.</p>

          <p>If an element node doesn't has a JSON type then the
          serialization of its childs is determined by the following
          rules:</p>

          <p>Only text and element node child are relevant. If the
          element node to serialize is the member of a JSON object and
          there is no relevant child node the value of that member
          will be an empty JSON string. If the only relevant child
          node of this element node is a text node then the JSON
          value of that text node will be the value of the object
          member. If the element has more than one relevant child
          nodes and the first one is a text node then the relevant
          childs will be serialized as JSON array. If the only
          relevant child node is an element node or the first relevant
          child is an element node and the node name of that only or
          first relevant child isn't equal to the array container node
          name all element node childs will be serialized as the
          members of a JSON object (while ignoring any intermixed text
          nodes). If the only or first relevant child is an element
          node and the node name of this child is equal to the array
          container element name then all relevant childs will be
          serialized as the values of a JSON array.</p>

          <p>If the element to serialize is a value of a JSON array
          and the node name of this element isn't equal to the array
          container node name that element will be seen as a
          container node for a JSON object and all element node childs
          will be serialized as the members of that array while
          ignoring any text node childs. If the element to serialize
          is a value of a JSON array and the node name of this element
          is equal to the array container node name, all relevant
          childs will be serialized as JSON array.</p>

          <p>If the <i class="m">-channel</i> option is given the serialization
          isn't returned as string but send directly to the channel,
          given as argument to the option.</p>

          <p>If the <i class="m">-indent</i> option is given and the argument
          given to this option isn't "none" then the returned JSON
................................................................................
      
        <dt>
<b class="method">internalSubset</b> <i class="m">?internalSubset?</i>
</dt>
        <dd>Returns the internal subset of the doctype declaration of the
document, if there is one, otherwise the empty string. If there is a value
given to the method, the internal subset of the document is set to this
value. Note, that none of the parsing methods preserve the internal subset
of a document; a freshly parsed document will always have an empty internal
subset. Also note, that the method doesen't do any syntactical check on a
given internal subset.</dd>
      

      
        <dt>
<b class="method">cdataSectionElements</b> <i class="m">(?URI:?localname|*) ?&lt;boolean&gt;?</i>
</dt>
        <dd>This method allows to control, for which element nodes
the text node childs will be serialized as CDATA sections (this affects only
serialization with the asXML method, no text node is altered in any
way by this method). IF the method is called with an element name as
first argument and a boolean with value true as second argument, every
text node child of every element node in the document with the same
name as the first argument will be serialized as CDATA section. If the
second argument is a boolean with value false, all text nodes of all
elements with the same name as the first argument will be serialized
as usual. Namespaced element names have to given in the form
namespace_URI:localname, not in the otherwise usual prefix:localname
form. With two arguments called, the method returns the used boolean
value. If the method is called with only an element name, it will
return a boolean value, indicating, if the text nodes childs of all
elements with that name in the document will be serialized as CDATA
section elements (return value 1) or not (return value 0). If the
method is called with only one argument and that argument is an
asterisk ('*'), then the method returns an unordered list of all
element names of the document, for which the text node childs will be
serialized as CDATA section nodes.</dd>
      

      
        <dt>
<b class="method">selectNodesNamespaces</b> <b class="option">?prefixUriList?</b>
</dt>
        <dd>This method allows to control a document global prefix
to namespace URI mapping, which will be used for selectNodes method
calls (on document as well as on all nodes, which belongs to the
document), if it is not overwritten by using the -namespaces option of

the selectNodes method. Any namespace prefix within an xpath
expression will be first resolved against this list. If the list bind
the same prefix to different namespaces, then the first binding will
win. If a prefix could not resolved against the document global prefix
/ namespaces list, then the namespace definitions in scope of the
context node will be used to resolve the prefix, as usual. If the
optional argument <i class="m">prefixUriList</i> is given, then the global prefix /
namespace list is set to this list and returns it. Without
the optional argument the method returns the current list. The
default is the empty list.</dd>
      

      
        <dt>
<b class="method">xslt</b> <b class="option">?-parameters
parameterList?</b> <b class="option">?-ignoreUndeclaredParameters?</b>
<b class="option">?-maxApplyDepth int?</b>
................................................................................
<p>The optional <i class="m">-parameters</i> option sets top level
&lt;xsl:param&gt; to string values. The <i class="m">parameterList</i> has to be a tcl
list consisting of parameter name and value pairs.</p>

<p>If the option <i class="m">-ignoreUndeclaredParameters</i> is given, then parameter
names in the <i class="m">parameterList</i> given to the <i class="m">-parameters</i> options that
are not declared as top-level parameters in the stylesheet are silently
ignored. Without this option, an error is raised, if the user tries to set a
top-level parameter, which is not declared in the stylesheet.</p>

<p>The option <i class="m">-maxApplyDepth</i> expects a positiv integer as
argument. By default, the xslt engine allows xslt templates to nest up
to 3000 levels (and raises error if they nest deeper). This limit can
be set by the <i class="m">-maxApplyDepth</i> option.</p>

<p>The <i class="m">-xsltmessagecmd</i> option sets a callback for xslt:message elements
................................................................................
<p>The optional <i class="m">-parameters</i> option sets top level
&lt;xsl:param&gt; to string values. The <i class="m">parameterList</i> has to be a tcl
list consisting of parameter name and value pairs.</p>

<p>If the option <i class="m">-ignoreUndeclaredParameters</i> is given, then parameter
names in the <i class="m">parameterList</i> given to the <i class="m">-parameters</i> options that
are not declared as top-level parameters in the stylesheet are silently
ignored. Without this option, an error is raised, if the user tries to set a
top-level parameter, which is not declared in the stylesheet.</p>

<p>The option <i class="m">-maxApplyDepth</i> expects a positiv integer as
argument. By default, the xslt engine allows xslt templates to nest up
to 3000 levels (and raises error if they nest deeper). This limit can
be set by the <i class="m">-maxApplyDepth</i> option.</p>

................................................................................
      

      
        <dt>
<b class="method">insertBefore</b> <i class="m">newChild</i>  <i class="m">refChild</i>
</dt>
        <dd>Insert <i class="m">newChild</i> before the <i class="m">refChild</i> into the list of
top level nodes of the document. If <i class="m">refChild</i> is the empty string, insert
<i class="m">newChild</i> at the end of the top level nodes.</dd>
      

      
        <dt>
<b class="method">replaceChild</b> <i class="m">newChild</i>  <i class="m">oldChild</i>
</dt>
        <dd>Replace <i class="m">oldChild</i> with <i class="m">newChild</i> in the list of
children of that node. The <i class="m">oldChild</i> node will be part of the
document fragment list after this operation.</dd>
      

      
        <dt>
<b class="method">appendFromList</b> <i class="m">list</i>
................................................................................
the xpath engine. Cast the value explicitly with the according xpath
functions (number(), boolean()) to another data type, if needed.</p>

<p>The option <i class="m">-namespaces</i> expects a tcl list with prefix /
namespace pairs as argument. If this option is not given, then any
namespace prefix within the xpath expression will be first resolved
against the list of prefix / namespace pairs set with the
selectNodesNamespaces method for the document, the node belongs to. If
this fails, then the namespace definitions in scope of the context
node will be used to resolve the prefix. If this option is given, any
namespace prefix within the xpath expression will be first resolved
against that given list (and ignoring the document global prefix /
namespace list). If the list bind the same prefix to different
namespaces, then the first binding will win.  If this fails, then the
namespace definitions in scope of the context node will be used to
resolve the prefix, as usual.</p>

<p>If the <i class="m">-cache</i> option is used with a true value, then the
<i class="m">xpathQuery</i> will be looked up in a document specific cache. If
the query is found, then the stored pre-compiled query will be used.
If the query isn't found, it will be compiled and stored in the cache,
for use in further calls. Please notice, that the <i class="m">xpathQuery</i> as
given as string is used as key for the cache. This means, that equal
XPath expressions, which differ only in white space are treated as
different cache entries. Special care is needed, if the XPath
expression includes namespace prefixes or references to tcl variables.
Both namespace prefixes and tcl variable references will be resolved
according to the XML prefix namespace mappings and tcl variable values
at expression compilation time. If the same XPath expression is used
later on in a context with other XML prefix namespace mappings or
values of the used tcl variables, make sure to first remove the
compiled expression from the cache with the help of the
................................................................................
from the cache, if it is there. The method always returns an
empty string.</dd>
      

  </dl><p>Otherwise, if an unknown method name is given, the command with the
same name as the given method within the namespace <tt class="samp">::dom::domDoc</tt> is
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
are not moved into the tree they are automaticaly deleted, when the whole
document gets deleted.</p>

    <h2><a name="SECTid0xb75940">SEE ALSO</a></h2><p class="seealso">dom, domNode</p>

    <h2><a name="SECTid0xb75cd0">KEYWORDS</a></h2><p class="keywords">
<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>
</p>

</div><hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</body>
</html>


|



|


|


|

|







 







|
|
|
|
|
|
<

|

|




|
|







 







|
|
>
|
|
|
|
|
|
|
|
>
|
|
|
|
>
|
|




|
|
|
|








|







|
|

|
|

|
|
|












|










|



|



|




|
|
|
|
|
|
|







 







|









|
|







|



|




|








|
|
|
>
|
|
|
|
|
|
|
|
|
|







 







|
|







 







|







 







|







|







 







|




|









|
|
|







 







|


|

|




|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
118
119
120
121
122
123
124
125
126
127
128
129
130

131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
...
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
...
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
...
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
...
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
...
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
...
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
...
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
<html>
<head>
<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">
</head><body>
<div class="header">
<div class="navbar" align="center">
<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>
</div><hr class="navsep">
</div><div class="body">
  <h2><a name="SECTid0x1e30210">NAME</a></h2><p class="namesection">
<b class="names">domDoc - </b><br>Manipulates an instance of a DOM document object</p>
  
  <h2><a name="SECTid0x1f1d4f0">SYNOPSIS</a></h2><pre class="syntax">domDocObjCmd <i class="m">method</i> ?<i class="m">arg arg ...</i>?</pre>

  <h2><a name="SECTid0x1f1d9d0">DESCRIPTION </a></h2><p>This command manipulates one particular instance of a document
object. <i class="m">method</i> indicates a specific method of the document class. These
methods should closely conform to the W3C recommendation "Document Object Model
(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
at these documents for a deeper understanding of the functionality.</p><p>The valid methods are:</p><dl class="commandlist">
        
          <dt>
<b class="method">documentElement</b> ?<i class="m">objVar</i>?</dt>
................................................................................
        channelId.</p>

        <p>If the option <i class="m">-escapeNonASCII</i> is given,
        every non 7 bit ASCII character in attribute values or element
        PCDATA content will be escaped as character reference in
        decimal representation.</p>

        <p>The flag <i class="m">-doctypeDeclaration</i> determines whether
        there will be a DOCTYPE declaration emitted before the first
        node of the document. The default is not to emit it. The
        DOCTYPE name will always be the element name of the document
        element. An external entity declaration of the external subset
        is only emitted if the document has a system identifier.</p>


        <p>The flag <i class="m">-xmlDeclaration</i> determines whether there
        will be an XML Declaration and a newline emitted before
        anything else. The default is not to emit one. If this flag is
        given with a true argument then</p>

        <p>
<i class="m">-encString</i> sets the encoding value in the XML
        Declaration. Otherwise this option is ignored. Please note
        that this option just enhances the string representation of the
        generated XML Declaration with an encoding information string,
        nothing more. It's up to the user to handle encoding in case
        of writing to a channel or reparsing.</p>
            
        <p>If the option <i class="m">-escapeAllQuot</i> is given,
        quotation marks will be escaped with &amp;quot; even in text
        content of elements.</p>
................................................................................
      

      
        <dt>
<b class="method">asHTML</b> <b class="option">?-channel
channelId?</b> <b class="option">?-escapeNonASCII?</b> <b class="option">?-htmlEntities?</b> <b class="option">?-doctypeDeclaration &lt;boolean&gt;?</b>
</dt> 
        <dd>Returns the DOM tree serialized acording to HTML rules
        (HTML elements are recognized regardless of case, without end
        tags for emtpy HTML elements etc.) as string or sends the
        output directly to the given channelId. If the option
        <i class="m">-escapeNonASCII</i> is given, every non 7 bit ASCII
        character in attribute values or element PCDATA content will
        be escaped as character reference in decimal representation.
        If the option <i class="m">-htmlEntities</i> is given, a character is
        written using its HTML 4.01 character entity reference, if it
        has one. If the flag <i class="m">-doctypeDeclaration</i> is given there
        will be a DOCTYPE declaration emitted before the first node of
        the document. The default is, to do not. The DOCTYPE name will
        always be the element name of the document element without
        case normalization. An external entity declaration of the
        external subset is only emitted, if the document has a system
        identifier. The doctype declaration will be written from the
        avaliable information, without check, if this is a known
        (w3c) HTML version information or if the document confirms to
        the given HTML version.</dd>
      

      
        <dt><b class="method">asText</b></dt>
          <dd>The asText method returns the tree by serializing the
          string-value of every text node in document order without
          any escaping. In effect, this is what the xslt output method
          "text" (XSLT 1.0 recommendation, section 16.3) does.</dd>
      

      
        <dt>
<b class="method">asJSON</b> <b class="option">?-indent none/0..8?</b> <b class="option">?-channel channelId?</b>
</dt>
          <dd>
<p>The asJSON method serializes the tree into a valid
          JSON data string. In general, this may be a lossy
          serialization. For this serialization all comment, character
          data sections and processing instruction nodes, all
          attributes and all XML namespaces are ignored. Only element
          and text nodes may be reflected in the generated JSON
          serialization. Appropriate JSON data type information of a
          node will be respected.</p>

          <p>If an element node has the JSON type OBJECT, then every
          element node child of this element will be serialized as
          member of that object, with the node name of the child as
          the member name and the relevant children of that child as
          the value. Every other child nodes will be ignored.</p>

          <p>If an element node has the JSON type ARRAY, then the text
          and element node children of that element node are serialized
          as the consecutive values of the array. Element node children
          of an ARRAY element will be container nodes for nested ARRAY
          or OBJECT values.</p>

          <p>Text nodes with the JSON types TRUE, FALSE or NULL will
          be serialized to the corresponding JSON token without
          looking at the value of the text node. A text node without
          JSON type will always be serialized as a JSON string token.
          A text node with JSON type NUMBER will be serialized as JSON
          number token if the text node value is in fact a valid JSON
          number and as a JSON string if not.</p>

          <p>If an element node doesn't has a JSON type then the
          serialization of its children is determined by the following
          rules:</p>

          <p>Only text and element node child are relevant. If the
          element node to serialize is the member of a JSON object and
          there is no relevant child node the value of that member
          will be an empty JSON string. If the only relevant child
          node of this element node is a text node then the JSON
          value of that text node will be the value of the object
          member. If the element has more than one relevant child
          nodes and the first one is a text node then the relevant
          children will be serialized as JSON array. If the only
          relevant child node is an element node or the first relevant
          child is an element node and the node name of that only or
          first relevant child isn't equal to the array container node
          name all element node children will be serialized as the
          members of a JSON object (while ignoring any intermixed text
          nodes). If the only or first relevant child is an element
          node and the node name of this child is equal to the array
          container element name then all relevant children will be
          serialized as the values of a JSON array.</p>

          <p>If the element to serialize is a value of a JSON array
          and the node name of this element isn't equal to the array
          container node name that element will be seen as a container
          node for a JSON object and all element node children will be
          serialized as the members of that array while ignoring any
          text node children. If the element to serialize is a value of
          a JSON array and the node name of this element is equal to
          the array container node name, all relevant children will be
          serialized as JSON array.</p>

          <p>If the <i class="m">-channel</i> option is given the serialization
          isn't returned as string but send directly to the channel,
          given as argument to the option.</p>

          <p>If the <i class="m">-indent</i> option is given and the argument
          given to this option isn't "none" then the returned JSON
................................................................................
      
        <dt>
<b class="method">internalSubset</b> <i class="m">?internalSubset?</i>
</dt>
        <dd>Returns the internal subset of the doctype declaration of the
document, if there is one, otherwise the empty string. If there is a value
given to the method, the internal subset of the document is set to this
value. Note that none of the parsing methods preserve the internal subset
of a document; a freshly parsed document will always have an empty internal
subset. Also note, that the method doesen't do any syntactical check on a
given internal subset.</dd>
      

      
        <dt>
<b class="method">cdataSectionElements</b> <i class="m">(?URI:?localname|*) ?&lt;boolean&gt;?</i>
</dt>
        <dd>This method allows to control for which element nodes
the text node children will be serialized as CDATA sections (this affects only
serialization with the asXML method, no text node is altered in any
way by this method). IF the method is called with an element name as
first argument and a boolean with value true as second argument, every
text node child of every element node in the document with the same
name as the first argument will be serialized as CDATA section. If the
second argument is a boolean with value false, all text nodes of all
elements with the same name as the first argument will be serialized
as usual. Namespaced element names have to be given in the form
namespace_URI:localname, not in the otherwise usual prefix:localname
form. With two arguments called, the method returns the used boolean
value. If the method is called with only an element name, it will
return a boolean value, indicating that the text node children of all
elements with that name in the document will be serialized as CDATA
section elements (return value 1) or not (return value 0). If the
method is called with only one argument and that argument is an
asterisk ('*'), then the method returns an unordered list of all
element names of the document, for which the text node children will be
serialized as CDATA section nodes.</dd>
      

      
        <dt>
<b class="method">selectNodesNamespaces</b> <b class="option">?prefixUriList?</b>
</dt>
        <dd>This method allows to control a document global prefix
        to namespace URI mapping, which will be used for selectNodes
        method calls (on document as well as on all nodes, which
        belongs to the document) if it is not overwritten by using
        the -namespaces option of the selectNodes method. Any
        namespace prefix within an xpath expression will be first
        resolved against this list. If the list binds the same prefix
        to different namespaces, then the first binding will win. If a
        prefix could not resolved against the document global prefix /
        namespaces list, then the namespace definitions in scope of
        the context node will be used to resolve the prefix, as usual.
        If the optional argument <i class="m">prefixUriList</i> is given, then
        the global prefix / namespace list is set to this list and
        returns it. Without the optional argument the method returns
        the current list. The default is the empty list.</dd>
      

      
        <dt>
<b class="method">xslt</b> <b class="option">?-parameters
parameterList?</b> <b class="option">?-ignoreUndeclaredParameters?</b>
<b class="option">?-maxApplyDepth int?</b>
................................................................................
<p>The optional <i class="m">-parameters</i> option sets top level
&lt;xsl:param&gt; to string values. The <i class="m">parameterList</i> has to be a tcl
list consisting of parameter name and value pairs.</p>

<p>If the option <i class="m">-ignoreUndeclaredParameters</i> is given, then parameter
names in the <i class="m">parameterList</i> given to the <i class="m">-parameters</i> options that
are not declared as top-level parameters in the stylesheet are silently
ignored. Without this option, an error is raised if the user tries to set a
top-level parameter that is not declared in the stylesheet.</p>

<p>The option <i class="m">-maxApplyDepth</i> expects a positiv integer as
argument. By default, the xslt engine allows xslt templates to nest up
to 3000 levels (and raises error if they nest deeper). This limit can
be set by the <i class="m">-maxApplyDepth</i> option.</p>

<p>The <i class="m">-xsltmessagecmd</i> option sets a callback for xslt:message elements
................................................................................
<p>The optional <i class="m">-parameters</i> option sets top level
&lt;xsl:param&gt; to string values. The <i class="m">parameterList</i> has to be a tcl
list consisting of parameter name and value pairs.</p>

<p>If the option <i class="m">-ignoreUndeclaredParameters</i> is given, then parameter
names in the <i class="m">parameterList</i> given to the <i class="m">-parameters</i> options that
are not declared as top-level parameters in the stylesheet are silently
ignored. Without this option, an error is raised if the user tries to set a
top-level parameter, which is not declared in the stylesheet.</p>

<p>The option <i class="m">-maxApplyDepth</i> expects a positiv integer as
argument. By default, the xslt engine allows xslt templates to nest up
to 3000 levels (and raises error if they nest deeper). This limit can
be set by the <i class="m">-maxApplyDepth</i> option.</p>

................................................................................
      

      
        <dt>
<b class="method">insertBefore</b> <i class="m">newChild</i>  <i class="m">refChild</i>
</dt>
        <dd>Insert <i class="m">newChild</i> before the <i class="m">refChild</i> into the list of
top level nodes of the document. If <i class="m">refChild</i> is the empty string, inserts
<i class="m">newChild</i> at the end of the top level nodes.</dd>
      

      
        <dt>
<b class="method">replaceChild</b> <i class="m">newChild</i>  <i class="m">oldChild</i>
</dt>
        <dd>Replaces <i class="m">oldChild</i> with <i class="m">newChild</i> in the list of
children of that node. The <i class="m">oldChild</i> node will be part of the
document fragment list after this operation.</dd>
      

      
        <dt>
<b class="method">appendFromList</b> <i class="m">list</i>
................................................................................
the xpath engine. Cast the value explicitly with the according xpath
functions (number(), boolean()) to another data type, if needed.</p>

<p>The option <i class="m">-namespaces</i> expects a tcl list with prefix /
namespace pairs as argument. If this option is not given, then any
namespace prefix within the xpath expression will be first resolved
against the list of prefix / namespace pairs set with the
selectNodesNamespaces method for the document the node belongs to. If
this fails, then the namespace definitions in scope of the context
node will be used to resolve the prefix. If this option is given, any
namespace prefix within the xpath expression will be first resolved
against that given list (and ignoring the document global prefix /
namespace list). If the list binds the same prefix to different
namespaces, then the first binding will win.  If this fails, then the
namespace definitions in scope of the context node will be used to
resolve the prefix, as usual.</p>

<p>If the <i class="m">-cache</i> option is used with a true value, then the
<i class="m">xpathQuery</i> will be looked up in a document specific cache. If
the query is found, then the stored pre-compiled query will be used.
If the query isn't found, it will be compiled and stored in the cache,
for use in further calls. Please notice, that the <i class="m">xpathQuery</i> as
given as string is used as key for the cache. This means that equal
XPath expressions, which differ only in white space, are treated as
different cache entries. Special care is needed if the XPath
expression includes namespace prefixes or references to tcl variables.
Both namespace prefixes and tcl variable references will be resolved
according to the XML prefix namespace mappings and tcl variable values
at expression compilation time. If the same XPath expression is used
later on in a context with other XML prefix namespace mappings or
values of the used tcl variables, make sure to first remove the
compiled expression from the cache with the help of the
................................................................................
from the cache, if it is there. The method always returns an
empty string.</dd>
      

  </dl><p>Otherwise, if an unknown method name is given, the command with the
same name as the given method within the namespace <tt class="samp">::dom::domDoc</tt> is
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
are not moved into the tree they are automaticaly deleted as soon as the whole
document gets deleted.</p>

    <h2><a name="SECTid0x1f7ab90">SEE ALSO</a></h2><p class="seealso">dom, domNode</p>

    <h2><a name="SECTid0x1f7af20">KEYWORDS</a></h2><p class="keywords">
<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>
</p>

</div><hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</body>
</html>

Changes to doc/domDoc.n.

243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
...
274
275
276
277
278
279
280
281
282

283
284
285
286
287
288
289
290

291
292
293
294

295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
...
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429

430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
...
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
...
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
...
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
...
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
...
686
687
688
689
690
691
692
693
694
695
696
697
698
channelId.
.PP
If the option \fI-escapeNonASCII\fR is given,
every non 7 bit ASCII character in attribute values or element
PCDATA content will be escaped as character reference in
decimal representation.
.PP
The flag \fI-doctypeDeclaration\fR
determines, whether there will be a DOCTYPE declaration
emitted before the first node of the document. The default is,
to do not. The DOCTYPE name will always be the element name of
the document element. An external entity declaration of the
external subset is only emitted, if the document has a system
identifier.
.PP
The flag \fI-xmlDeclaration\fR determines, whether there
will be an XML Declaration and a newline emitted before
anything else. The default is, to do not. If this flag is
given with a true argument then
.PP
\&\fI-encString\fR sets the encoding value in the XML
Declaration. Otherwise, this option is ignored. Please note,
that this option just enhance the string representation of the
generated XML Declaration with an encoding information string,
nothing more. It's up to the user to handle encoding in case
of writing to a channel or reparsing.
.PP
If the option \fI-escapeAllQuot\fR is given,
quotation marks will be escaped with &quot; even in text
content of elements.
................................................................................
If the option \fI-indentAttrs\fR is
given, then attributes will each be separated with newlines
and indented to the same level as the parent node plus the
value given as argument to \fI-indentAttrs\fR (0..8).
.RE
.TP
\&\fB\fBasHTML\fP \fB?-channel channelId?\fP \fB?-escapeNonASCII?\fP \fB?-htmlEntities?\fP \fB?-doctypeDeclaration <boolean>?\fP
\&\fRReturns the DOM tree serialized acording to HTML rules (HTML
elements are recognized regardless of case, without end tags for emtpy HTML

elements etc.), as string or sends the output directly to the given
channelId. If the option \fI-escapeNonASCII\fR is given, every non 7 bit ASCII
character in attribute values or element PCDATA content will be escaped as
character reference in decimal representation. If the option
\&\fI-htmlEntities\fR is given, a character is outputed using a HTML 4.01
character entity reference, if one is defined for it. The flag
\&\fI-doctypeDeclaration\fR determines, whether there will be a DOCTYPE
declaration emitted before the first node of the document. The default is, to

do not. The DOCTYPE name will always be the element name of the document
element without case normalization. An external entity declaration of the
external subset is only emitted, if the document has a system identifier. The
doctype declaration will be written from the avaliable informations, without

check, if this is a known (w3c) HTML version information or if the document
confirms to the given HTML version.
.TP
\&\fB\fBasText\fP
\&\fRThe asText method outputs the result tree by outputting
the string-value of every text node in the result tree in document
order without any escaping. In effect, this is what the xslt output method
"text" (XSLT 1.0 recommendation, section 16.3) does.
.TP
\&\fB\fBasJSON\fP \fB?-indent none/0..8?\fP \fB?-channel channelId?\fP
\&\fR
.RS
.PP
The asJSON method serializes the tree into a valid
JSON data string. In general this may be a lossy
serialization. For this serialization all comment, character
data sections and processing instruction nodes, all
attributes and all XML namespaces are ignored. Only element
and text nodes may be reflected in the generated JSON
serialization. Appropriate JSON data type information of a
node will be respected.
.PP
If an element node has the JSON type OBJECT then every
element node child of this element will be serializend as
member of that object, with the node name of the child as
the member name and the relevant childs of that child as the
value. Every other child nodes will be ignored.
.PP
If an element node has the JSON type ARRAY then the text
and element node childs of that element node are serialized
as the consecutive values of the array. Element node childs
of an ARRAY element will be container nodes for nested ARRAY
or OBJECT values.
.PP
Text nodes with the JSON types TRUE, FALSE or NULL will
be serialized to the corresponding JSON token without
looking at the value of the text node. A text node without
JSON type will always be serialized as a JSON string token.
A text node with JSON type NUMBER will be serialized as JSON
number token if the text node value is in fact a valid JSON
number and as a JSON string if not.
.PP
If an element node doesn't has a JSON type then the
serialization of its childs is determined by the following
rules:
.PP
Only text and element node child are relevant. If the
element node to serialize is the member of a JSON object and
there is no relevant child node the value of that member
will be an empty JSON string. If the only relevant child
node of this element node is a text node then the JSON
value of that text node will be the value of the object
member. If the element has more than one relevant child
nodes and the first one is a text node then the relevant
childs will be serialized as JSON array. If the only
relevant child node is an element node or the first relevant
child is an element node and the node name of that only or
first relevant child isn't equal to the array container node
name all element node childs will be serialized as the
members of a JSON object (while ignoring any intermixed text
nodes). If the only or first relevant child is an element
node and the node name of this child is equal to the array
container element name then all relevant childs will be
serialized as the values of a JSON array.
.PP
If the element to serialize is a value of a JSON array
and the node name of this element isn't equal to the array
container node name that element will be seen as a
container node for a JSON object and all element node childs
will be serialized as the members of that array while
ignoring any text node childs. If the element to serialize
is a value of a JSON array and the node name of this element
is equal to the array container node name, all relevant
childs will be serialized as JSON array.
.PP
If the \fI-channel\fR option is given the serialization
isn't returned as string but send directly to the channel,
given as argument to the option.
.PP
If the \fI-indent\fR option is given and the argument
given to this option isn't "none" then the returned JSON
................................................................................
given to the method, the system identifier of the document is set to this
value.
.TP
\&\fB\fBinternalSubset\fP \fI?internalSubset?\fB
\&\fRReturns the internal subset of the doctype declaration of the
document, if there is one, otherwise the empty string. If there is a value
given to the method, the internal subset of the document is set to this
value. Note, that none of the parsing methods preserve the internal subset
of a document; a freshly parsed document will always have an empty internal
subset. Also note, that the method doesen't do any syntactical check on a
given internal subset.
.TP
\&\fB\fBcdataSectionElements\fP \fI(?URI:?localname|*) ?<boolean>?\fB
\&\fRThis method allows to control, for which element nodes
the text node childs will be serialized as CDATA sections (this affects only
serialization with the asXML method, no text node is altered in any
way by this method). IF the method is called with an element name as
first argument and a boolean with value true as second argument, every
text node child of every element node in the document with the same
name as the first argument will be serialized as CDATA section. If the
second argument is a boolean with value false, all text nodes of all
elements with the same name as the first argument will be serialized
as usual. Namespaced element names have to given in the form
namespace_URI:localname, not in the otherwise usual prefix:localname
form. With two arguments called, the method returns the used boolean
value. If the method is called with only an element name, it will
return a boolean value, indicating, if the text nodes childs of all
elements with that name in the document will be serialized as CDATA
section elements (return value 1) or not (return value 0). If the
method is called with only one argument and that argument is an
asterisk ('*'), then the method returns an unordered list of all
element names of the document, for which the text node childs will be
serialized as CDATA section nodes.
.TP
\&\fB\fBselectNodesNamespaces\fP \fB?prefixUriList?\fP
\&\fRThis method allows to control a document global prefix
to namespace URI mapping, which will be used for selectNodes method
calls (on document as well as on all nodes, which belongs to the
document), if it is not overwritten by using the -namespaces option of

the selectNodes method. Any namespace prefix within an xpath
expression will be first resolved against this list. If the list bind
the same prefix to different namespaces, then the first binding will
win. If a prefix could not resolved against the document global prefix
/ namespaces list, then the namespace definitions in scope of the
context node will be used to resolve the prefix, as usual. If the
optional argument \fIprefixUriList\fR is given, then the global prefix /
namespace list is set to this list and returns it. Without
the optional argument the method returns the current list. The
default is the empty list.
.TP
\&\fB\fBxslt\fP \fB?-parameters parameterList?\fP \fB?-ignoreUndeclaredParameters?\fP \fB?-maxApplyDepth int?\fP \fB?-xsltmessagecmd script?\fP \fIstylesheet\fB \fI?outputVar?\fB
\&\fRApplies an XSLT transformation on the whole document of the node
object using the XSLT \fIstylesheet\fR (given as domDoc). Returns a document
object containing the result document of the transformation and stores that
document object in the optional \fIoutputVar\fR, if that was given.
.RS
................................................................................
The optional \fI-parameters\fR option sets top level
<xsl:param> to string values. The \fIparameterList\fR has to be a tcl
list consisting of parameter name and value pairs.
.PP
If the option \fI-ignoreUndeclaredParameters\fR is given, then parameter
names in the \fIparameterList\fR given to the \fI-parameters\fR options that
are not declared as top-level parameters in the stylesheet are silently
ignored. Without this option, an error is raised, if the user tries to set a
top-level parameter, which is not declared in the stylesheet.
.PP
The option \fI-maxApplyDepth\fR expects a positiv integer as
argument. By default, the xslt engine allows xslt templates to nest up
to 3000 levels (and raises error if they nest deeper). This limit can
be set by the \fI-maxApplyDepth\fR option.
.PP
The \fI-xsltmessagecmd\fR option sets a callback for xslt:message elements
................................................................................
The optional \fI-parameters\fR option sets top level
<xsl:param> to string values. The \fIparameterList\fR has to be a tcl
list consisting of parameter name and value pairs.
.PP
If the option \fI-ignoreUndeclaredParameters\fR is given, then parameter
names in the \fIparameterList\fR given to the \fI-parameters\fR options that
are not declared as top-level parameters in the stylesheet are silently
ignored. Without this option, an error is raised, if the user tries to set a
top-level parameter, which is not declared in the stylesheet.
.PP
The option \fI-maxApplyDepth\fR expects a positiv integer as
argument. By default, the xslt engine allows xslt templates to nest up
to 3000 levels (and raises error if they nest deeper). This limit can
be set by the \fI-maxApplyDepth\fR option.
.PP
................................................................................
\&\fRReturns a list of the top level nodes of the document.
.TP
\&\fB\fBownerDocument\fP \fB?domObjVar?\fP
\&\fRReturns the document itself.
.TP
\&\fB\fBinsertBefore\fP \fInewChild\fB  \fIrefChild\fB
\&\fRInsert \fInewChild\fR before the \fIrefChild\fR into the list of
top level nodes of the document. If \fIrefChild\fR is the empty string, insert
\&\fInewChild\fR at the end of the top level nodes.
.TP
\&\fB\fBreplaceChild\fP \fInewChild\fB  \fIoldChild\fB
\&\fRReplace \fIoldChild\fR with \fInewChild\fR in the list of
children of that node. The \fIoldChild\fR node will be part of the
document fragment list after this operation.
.TP
\&\fB\fBappendFromList\fP \fIlist\fB
\&\fRParses \fIlist\fR , creates an according DOM subtree and
appends this subtree at the end of the current list of top level nodes of the document.
.TP
................................................................................
the xpath engine. Cast the value explicitly with the according xpath
functions (number(), boolean()) to another data type, if needed.
.PP
The option \fI-namespaces\fR expects a tcl list with prefix /
namespace pairs as argument. If this option is not given, then any
namespace prefix within the xpath expression will be first resolved
against the list of prefix / namespace pairs set with the
selectNodesNamespaces method for the document, the node belongs to. If
this fails, then the namespace definitions in scope of the context
node will be used to resolve the prefix. If this option is given, any
namespace prefix within the xpath expression will be first resolved
against that given list (and ignoring the document global prefix /
namespace list). If the list bind the same prefix to different
namespaces, then the first binding will win.  If this fails, then the
namespace definitions in scope of the context node will be used to
resolve the prefix, as usual.
.PP
If the \fI-cache\fR option is used with a true value, then the
\&\fIxpathQuery\fR will be looked up in a document specific cache. If
the query is found, then the stored pre-compiled query will be used.
If the query isn't found, it will be compiled and stored in the cache,
for use in further calls. Please notice, that the \fIxpathQuery\fR as
given as string is used as key for the cache. This means, that equal
XPath expressions, which differ only in white space are treated as
different cache entries. Special care is needed, if the XPath
expression includes namespace prefixes or references to tcl variables.
Both namespace prefixes and tcl variable references will be resolved
according to the XML prefix namespace mappings and tcl variable values
at expression compilation time. If the same XPath expression is used
later on in a context with other XML prefix namespace mappings or
values of the used tcl variables, make sure to first remove the
compiled expression from the cache with the help of the
................................................................................
empty string.
.PP
Otherwise, if an unknown method name is given, the command with the
same name as the given method within the namespace \fB::dom::domDoc\fR is
tried to be executed. This allows quick method additions on Tcl level.
.PP
Newly created nodes are appended to a hidden fragment list. If they
are not moved into the tree they are automaticaly deleted, when the whole
document gets deleted.
.SH "SEE ALSO"
dom, domNode
.SH KEYWORDS
DOM node creation, document element







|
|
|
|
|
|
<

|

|



|
|







 







|
|
>
|
|
|
|
|
|
|
|
>
|
|
|
|
>
|
|


|
|
|







|







|
|

|
|

|
|
|












|










|



|



|




|
|
|
|
|
|
|







 







|





|
|







|



|




|




|
|
|
>
|
|
|
|
|
|
|
|
|
|







 







|
|







 







|







 







|



|







 







|




|









|
|
|







 







|





243
244
245
246
247
248
249
250
251
252
253
254
255

256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
...
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
...
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
...
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
...
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
...
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
...
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
...
689
690
691
692
693
694
695
696
697
698
699
700
701
channelId.
.PP
If the option \fI-escapeNonASCII\fR is given,
every non 7 bit ASCII character in attribute values or element
PCDATA content will be escaped as character reference in
decimal representation.
.PP
The flag \fI-doctypeDeclaration\fR determines whether
there will be a DOCTYPE declaration emitted before the first
node of the document. The default is not to emit it. The
DOCTYPE name will always be the element name of the document
element. An external entity declaration of the external subset
is only emitted if the document has a system identifier.

.PP
The flag \fI-xmlDeclaration\fR determines whether there
will be an XML Declaration and a newline emitted before
anything else. The default is not to emit one. If this flag is
given with a true argument then
.PP
\&\fI-encString\fR sets the encoding value in the XML
Declaration. Otherwise this option is ignored. Please note
that this option just enhances the string representation of the
generated XML Declaration with an encoding information string,
nothing more. It's up to the user to handle encoding in case
of writing to a channel or reparsing.
.PP
If the option \fI-escapeAllQuot\fR is given,
quotation marks will be escaped with &quot; even in text
content of elements.
................................................................................
If the option \fI-indentAttrs\fR is
given, then attributes will each be separated with newlines
and indented to the same level as the parent node plus the
value given as argument to \fI-indentAttrs\fR (0..8).
.RE
.TP
\&\fB\fBasHTML\fP \fB?-channel channelId?\fP \fB?-escapeNonASCII?\fP \fB?-htmlEntities?\fP \fB?-doctypeDeclaration <boolean>?\fP
\&\fRReturns the DOM tree serialized acording to HTML rules
(HTML elements are recognized regardless of case, without end
tags for emtpy HTML elements etc.) as string or sends the
output directly to the given channelId. If the option
\&\fI-escapeNonASCII\fR is given, every non 7 bit ASCII
character in attribute values or element PCDATA content will
be escaped as character reference in decimal representation.
If the option \fI-htmlEntities\fR is given, a character is
written using its HTML 4.01 character entity reference, if it
has one. If the flag \fI-doctypeDeclaration\fR is given there
will be a DOCTYPE declaration emitted before the first node of
the document. The default is, to do not. The DOCTYPE name will
always be the element name of the document element without
case normalization. An external entity declaration of the
external subset is only emitted, if the document has a system
identifier. The doctype declaration will be written from the
avaliable information, without check, if this is a known
(w3c) HTML version information or if the document confirms to
the given HTML version.
.TP
\&\fB\fBasText\fP
\&\fRThe asText method returns the tree by serializing the
string-value of every text node in document order without
any escaping. In effect, this is what the xslt output method
"text" (XSLT 1.0 recommendation, section 16.3) does.
.TP
\&\fB\fBasJSON\fP \fB?-indent none/0..8?\fP \fB?-channel channelId?\fP
\&\fR
.RS
.PP
The asJSON method serializes the tree into a valid
JSON data string. In general, this may be a lossy
serialization. For this serialization all comment, character
data sections and processing instruction nodes, all
attributes and all XML namespaces are ignored. Only element
and text nodes may be reflected in the generated JSON
serialization. Appropriate JSON data type information of a
node will be respected.
.PP
If an element node has the JSON type OBJECT, then every
element node child of this element will be serialized as
member of that object, with the node name of the child as
the member name and the relevant children of that child as
the value. Every other child nodes will be ignored.
.PP
If an element node has the JSON type ARRAY, then the text
and element node children of that element node are serialized
as the consecutive values of the array. Element node children
of an ARRAY element will be container nodes for nested ARRAY
or OBJECT values.
.PP
Text nodes with the JSON types TRUE, FALSE or NULL will
be serialized to the corresponding JSON token without
looking at the value of the text node. A text node without
JSON type will always be serialized as a JSON string token.
A text node with JSON type NUMBER will be serialized as JSON
number token if the text node value is in fact a valid JSON
number and as a JSON string if not.
.PP
If an element node doesn't has a JSON type then the
serialization of its children is determined by the following
rules:
.PP
Only text and element node child are relevant. If the
element node to serialize is the member of a JSON object and
there is no relevant child node the value of that member
will be an empty JSON string. If the only relevant child
node of this element node is a text node then the JSON
value of that text node will be the value of the object
member. If the element has more than one relevant child
nodes and the first one is a text node then the relevant
children will be serialized as JSON array. If the only
relevant child node is an element node or the first relevant
child is an element node and the node name of that only or
first relevant child isn't equal to the array container node
name all element node children will be serialized as the
members of a JSON object (while ignoring any intermixed text
nodes). If the only or first relevant child is an element
node and the node name of this child is equal to the array
container element name then all relevant children will be
serialized as the values of a JSON array.
.PP
If the element to serialize is a value of a JSON array
and the node name of this element isn't equal to the array
container node name that element will be seen as a container
node for a JSON object and all element node children will be
serialized as the members of that array while ignoring any
text node children. If the element to serialize is a value of
a JSON array and the node name of this element is equal to
the array container node name, all relevant children will be
serialized as JSON array.
.PP
If the \fI-channel\fR option is given the serialization
isn't returned as string but send directly to the channel,
given as argument to the option.
.PP
If the \fI-indent\fR option is given and the argument
given to this option isn't "none" then the returned JSON
................................................................................
given to the method, the system identifier of the document is set to this
value.
.TP
\&\fB\fBinternalSubset\fP \fI?internalSubset?\fB
\&\fRReturns the internal subset of the doctype declaration of the
document, if there is one, otherwise the empty string. If there is a value
given to the method, the internal subset of the document is set to this
value. Note that none of the parsing methods preserve the internal subset
of a document; a freshly parsed document will always have an empty internal
subset. Also note, that the method doesen't do any syntactical check on a
given internal subset.
.TP
\&\fB\fBcdataSectionElements\fP \fI(?URI:?localname|*) ?<boolean>?\fB
\&\fRThis method allows to control for which element nodes
the text node children will be serialized as CDATA sections (this affects only
serialization with the asXML method, no text node is altered in any
way by this method). IF the method is called with an element name as
first argument and a boolean with value true as second argument, every
text node child of every element node in the document with the same
name as the first argument will be serialized as CDATA section. If the
second argument is a boolean with value false, all text nodes of all
elements with the same name as the first argument will be serialized
as usual. Namespaced element names have to be given in the form
namespace_URI:localname, not in the otherwise usual prefix:localname
form. With two arguments called, the method returns the used boolean
value. If the method is called with only an element name, it will
return a boolean value, indicating that the text node children of all
elements with that name in the document will be serialized as CDATA
section elements (return value 1) or not (return value 0). If the
method is called with only one argument and that argument is an
asterisk ('*'), then the method returns an unordered list of all
element names of the document, for which the text node children will be
serialized as CDATA section nodes.
.TP
\&\fB\fBselectNodesNamespaces\fP \fB?prefixUriList?\fP
\&\fRThis method allows to control a document global prefix
to namespace URI mapping, which will be used for selectNodes
method calls (on document as well as on all nodes, which
belongs to the document) if it is not overwritten by using
the -namespaces option of the selectNodes method. Any
namespace prefix within an xpath expression will be first
resolved against this list. If the list binds the same prefix
to different namespaces, then the first binding will win. If a
prefix could not resolved against the document global prefix /
namespaces list, then the namespace definitions in scope of
the context node will be used to resolve the prefix, as usual.
If the optional argument \fIprefixUriList\fR is given, then
the global prefix / namespace list is set to this list and
returns it. Without the optional argument the method returns
the current list. The default is the empty list.
.TP
\&\fB\fBxslt\fP \fB?-parameters parameterList?\fP \fB?-ignoreUndeclaredParameters?\fP \fB?-maxApplyDepth int?\fP \fB?-xsltmessagecmd script?\fP \fIstylesheet\fB \fI?outputVar?\fB
\&\fRApplies an XSLT transformation on the whole document of the node
object using the XSLT \fIstylesheet\fR (given as domDoc). Returns a document
object containing the result document of the transformation and stores that
document object in the optional \fIoutputVar\fR, if that was given.
.RS
................................................................................
The optional \fI-parameters\fR option sets top level
<xsl:param> to string values. The \fIparameterList\fR has to be a tcl
list consisting of parameter name and value pairs.
.PP
If the option \fI-ignoreUndeclaredParameters\fR is given, then parameter
names in the \fIparameterList\fR given to the \fI-parameters\fR options that
are not declared as top-level parameters in the stylesheet are silently
ignored. Without this option, an error is raised if the user tries to set a
top-level parameter that is not declared in the stylesheet.
.PP
The option \fI-maxApplyDepth\fR expects a positiv integer as
argument. By default, the xslt engine allows xslt templates to nest up
to 3000 levels (and raises error if they nest deeper). This limit can
be set by the \fI-maxApplyDepth\fR option.
.PP
The \fI-xsltmessagecmd\fR option sets a callback for xslt:message elements
................................................................................
The optional \fI-parameters\fR option sets top level
<xsl:param> to string values. The \fIparameterList\fR has to be a tcl
list consisting of parameter name and value pairs.
.PP
If the option \fI-ignoreUndeclaredParameters\fR is given, then parameter
names in the \fIparameterList\fR given to the \fI-parameters\fR options that
are not declared as top-level parameters in the stylesheet are silently
ignored. Without this option, an error is raised if the user tries to set a
top-level parameter, which is not declared in the stylesheet.
.PP
The option \fI-maxApplyDepth\fR expects a positiv integer as
argument. By default, the xslt engine allows xslt templates to nest up
to 3000 levels (and raises error if they nest deeper). This limit can
be set by the \fI-maxApplyDepth\fR option.
.PP
................................................................................
\&\fRReturns a list of the top level nodes of the document.
.TP
\&\fB\fBownerDocument\fP \fB?domObjVar?\fP
\&\fRReturns the document itself.
.TP
\&\fB\fBinsertBefore\fP \fInewChild\fB  \fIrefChild\fB
\&\fRInsert \fInewChild\fR before the \fIrefChild\fR into the list of
top level nodes of the document. If \fIrefChild\fR is the empty string, inserts
\&\fInewChild\fR at the end of the top level nodes.
.TP
\&\fB\fBreplaceChild\fP \fInewChild\fB  \fIoldChild\fB
\&\fRReplaces \fIoldChild\fR with \fInewChild\fR in the list of
children of that node. The \fIoldChild\fR node will be part of the
document fragment list after this operation.
.TP
\&\fB\fBappendFromList\fP \fIlist\fB
\&\fRParses \fIlist\fR , creates an according DOM subtree and
appends this subtree at the end of the current list of top level nodes of the document.
.TP
................................................................................
the xpath engine. Cast the value explicitly with the according xpath
functions (number(), boolean()) to another data type, if needed.
.PP
The option \fI-namespaces\fR expects a tcl list with prefix /
namespace pairs as argument. If this option is not given, then any
namespace prefix within the xpath expression will be first resolved
against the list of prefix / namespace pairs set with the
selectNodesNamespaces method for the document the node belongs to. If
this fails, then the namespace definitions in scope of the context
node will be used to resolve the prefix. If this option is given, any
namespace prefix within the xpath expression will be first resolved
against that given list (and ignoring the document global prefix /
namespace list). If the list binds the same prefix to different
namespaces, then the first binding will win.  If this fails, then the
namespace definitions in scope of the context node will be used to
resolve the prefix, as usual.
.PP
If the \fI-cache\fR option is used with a true value, then the
\&\fIxpathQuery\fR will be looked up in a document specific cache. If
the query is found, then the stored pre-compiled query will be used.
If the query isn't found, it will be compiled and stored in the cache,
for use in further calls. Please notice, that the \fIxpathQuery\fR as
given as string is used as key for the cache. This means that equal
XPath expressions, which differ only in white space, are treated as
different cache entries. Special care is needed if the XPath
expression includes namespace prefixes or references to tcl variables.
Both namespace prefixes and tcl variable references will be resolved
according to the XML prefix namespace mappings and tcl variable values
at expression compilation time. If the same XPath expression is used
later on in a context with other XML prefix namespace mappings or
values of the used tcl variables, make sure to first remove the
compiled expression from the cache with the help of the
................................................................................
empty string.
.PP
Otherwise, if an unknown method name is given, the command with the
same name as the given method within the namespace \fB::dom::domDoc\fR is
tried to be executed. This allows quick method additions on Tcl level.
.PP
Newly created nodes are appended to a hidden fragment list. If they
are not moved into the tree they are automaticaly deleted as soon as the whole
document gets deleted.
.SH "SEE ALSO"
dom, domNode
.SH KEYWORDS
DOM node creation, document element

Changes to doc/domNode.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
..
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
..
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
...
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
...
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165


166
167
168
169
170
171
172
...
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225

226
227
228
229
230
231
232
233
...
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
...
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
...
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
...
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
...
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
...
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
...
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
...
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
...
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
...
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
<html>
<head>
<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 $">
</head><body>
<div class="header">
<div class="navbar" align="center">
<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>
</div><hr class="navsep">
</div><div class="body">
  <h2><a name="SECTid0xb275d0">NAME</a></h2><p class="namesection">
<b class="names">domNode - </b><br>Manipulates an instance of a DOM node object</p>



  <h2><a name="SECTid0xb558b0">SYNOPSIS</a></h2><pre class="syntax"> $nodeObject <i class="m">method</i>  <i class="m">arg arg ...</i>
</pre>
  <h2><a name="SECTid0xad87e0"> DESCRIPTION </a></h2><p>This command manipulates one particular instance of a DOM node object.
<i class="m">method</i> indicates a specific method of the node class. These methods
should closely conform to the W3C recommendation "Document Object Model
(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>)
as well to parts of the W3C draft "XML Pointer Language (XPointer)"
(<a href="http://www.w3.org/TR/1998/WD-xptr-19980303">http://www.w3.org/TR/1998/WD-xptr-19980303</a>).
Please note, that the XPointer methods are deprecated. Use DOM methods
or XPath expressions instead of them.</p><p>The selectNodes method implements the "XML Path
................................................................................
optional argument <i class="m">newValue</i> is given, the node is set to that
value.</dd>

      

      
        <dt><b class="method">hasChildNodes</b></dt>
        <dd>Returns 1 if the has children. Otherwise 0 is returned.</dd>
      

      
        <dt>
<b class="method">parentNode</b> <b class="variable">?objVar?</b>
</dt>
        <dd>Returns the parent node.</dd>
................................................................................
      
        <dt><b class="method">childNodesLive</b></dt>
        <dd>Returns a "live" nodeList object of the child nodes of
the node in the sense of the DOM recommendation. This nodeList object is
"live" in the sense that, for instance, changes to the children of
the node object that it was created from are immediately reflected in the nodes
returned by the NodeList accessors; it is not a static snapshot of the content
of the node. The both accessors know by the nodeList object are "item
&lt;index&gt;", which returns the indexth item in the collection, and
"length", which returns the number of nodes in the list.</dd>
      

      
        <dt>
<b class="method">firstChild</b> <b class="variable">?objVar?</b>
................................................................................
        <dd>Returns the last child as a node object.</dd>
      
      
      
        <dt>
<b class="method">nextSibling</b>  <b class="variable">?objVar?</b>
</dt>
        <dd>Returns the next sibling relativ to the current node as a node
object.</dd>
      

      
        <dt>
<b class="method">previousSibling</b> <b class="variable">?objVar?</b>
</dt>
        <dd>Returns the next sibling relativ to the current node as a node
object.</dd>
      

      
        <dt>
<b class="method">getElementsByTagName</b> <i class="m">name</i>
</dt>
................................................................................
<i class="m">uri</i>.</dd>
      

      
        <dt>
<b class="method">getElementById</b> <i class="m">id</i>
</dt>
        <dd>Returns the node having a id attribute with value
<i class="m">id</i> or the emtpy string, if no node has an id attribute with that value.</dd>
      

      
        <dt>
<b class="method">hasAttribute</b> <i class="m">attributeName</i>
</dt>
        <dd>Returns 1 if the object node contains an attribute with name
................................................................................
<i class="m">attributeName</i> . Otherwise 0 is returned.</dd>
      

      
        <dt>
<b class="method">getAttribute</b> <i class="m">attributeName  ?defaultValue?</i>
</dt>
        <dd>Returns the value of the attribute <i class="m">attributeName</i>. If
attribute is not available <i class="m">defaultValue</i> is returned.</dd>
      

      
        <dt>
<b class="method">setAttribute</b> <i class="m">attributeName newValue 
?attributeName newValue ...?</i>
</dt>
        <dd>Sets the value for one or more attributes. Every
<i class="m">attributeName</i> is set to the corresponding <i class="m">newValue</i>. If there
isn't an attribute for one or more of the <i class="m">attributeName</i> this will
create that attribute.</dd>



      

      
        <dt>
<b class="method">removeAttribute</b> <i class="m">attributeName</i>
</dt>
        <dd>Removes the attribute <i class="m">attributeName</i>.</dd>
................................................................................
        <pre class="example">$node setAttributeNS "http://some.uri.com/wow" prefix:attr1 attrValue</pre>

<p>If the uri is the empty string and the attribute name hasn't a prefix, this
method has the same effect as the method <b>setAttribute</b>.</p>

        <pre class="example">$node setAttributeNS "" attri "some Value"</pre>

<p>XML namespace nodes are not in any namespace. Set them this way:</p>

        <pre class="example">$node setAttributeNS "" xmlns:myprefix "myNamespaceURI"
$node setAttributeNS "" xmlns "newDefaultNamespace"</pre>

<p>If your <i class="m">qualifiedName</i> has the prefix "xml" and you give the empty
string as <i class="m">uri</i>, the namespace of the attribute defaults to
"http://www.w3.org/XML/1998/namespace", as the DOM 2 recommendation
requests. With the exceptions of the special prefixes "xmlns" and "xml" you
always must provide a non emtpy <i class="m">uri</i>, if your <i class="m">qualifiedName</i> has a
prefix.</p>

        </dd>
      

      
        <dt>
<b class="method">removeAttributeNS</b> <i class="m">uri</i> <i class="m">localName</i>
</dt>
        <dd>Removes the attribute with the local name <i class="m">localName</i> within
................................................................................
      

      
        <dt>
<b class="method">attributes</b> <b class="option">?attributeNamePattern?</b>
</dt>
        <dd>Returns all attributes matching the <i class="m">attributeNamePattern</i>.
If <i class="m">attributeNamePattern</i> isn't given all attributes are returned as a Tcl
list.</dd>
      

      
        <dt>
<b class="method">appendChild</b> <i class="m">newChild</i>
</dt>
        <dd>Append <i class="m">newChild</i> to the end of the child list of the
node.</dd>
      

      
        <dt>
<b class="method">insertBefore</b> <i class="m">newChild</i>  <i class="m">refChild</i>
</dt>
        <dd>Insert <i class="m">newChild</i> before the <i class="m">refChild</i> into the list of
children of node. If <i class="m">refChild</i> is the empty string, insert
<i class="m">newChild</i> at the end of the child nodes list of that node.</dd>
      

      
        <dt>
<b class="method">replaceChild</b> <i class="m">newChild</i>  <i class="m">oldChild</i>
</dt>
        <dd>Replace <i class="m">oldChild</i> with <i class="m">newChild</i> in the list of
children of that node. The <i class="m">oldChild</i> node will be part of the
document fragment list after this operation.</dd>
      

      
        <dt>
<b class="method">removeChild</b> <i class="m">child</i>
</dt>
        <dd>Removes <i class="m">child</i> from the list of children of that node
<i class="m">child</i> will be part of the document fragment list after this
operation. It is not physically deleted.</dd>
      

      
        <dt><b class="method">delete</b></dt>
        <dd>Deletes the given node and its complete child tree
and frees the complete internal memory. The affected nodes are not accessible
through the document fragment list.</dd>
................................................................................
the XPath syntax to put an XPath variable. Ignoring the syntax rules of
XPath the Tcl variable name may be any legal Tcl var name: local
variables, global variables, array entries and so on. The value will
always be seen as string literal by the xpath engine. Cast the value
explicitly with the according xpath functions (number(), boolean()) to
another data type, if needed.</p>

<p>Simmilar to the above descibed way to inject literals in a secure
way into the XPath expression using tcl variable references there is a
syntax to inject element names from tcl variables. At every place
where the XPath syntax allows a node test there could be a tcl
variable reference (in any form), just the leading $ replaced with %.
This allows to select nodes with 'strange' (invalid, according to the
appropriate XML production rule) node names which may be needed in
case of working with JSON data.</p>
................................................................................
namespace prefix within the xpath expression will be first resolved
against the list of prefix / namespace pairs set with the
selectNodesNamespaces method for the document, the node belongs to. If
this fails, then the namespace definitions in scope of the context
node will be used to resolve the prefix. If this option is given, any
namespace prefix within the xpath expression will be first resolved
against that given list (and ignoring the document global prefix /
namespace list). If the list bind the same prefix to different
namespaces, then the first binding will win.  If this fails, then the
namespace definitions in scope of the context node will be used to
resolve the prefix, as usual.</p>

<p>If the <i class="m">-cache</i> option is used with a true value, then the
<i class="m">xpathQuery</i> will be looked up in a document specific cache. If
the query is found, then the stored pre-compiled query will be used.
If the query isn't found, it will be compiled and stored in the cache,
for use in further calls. Please notice, that the <i class="m">xpathQuery</i> as
given as string is used as key for the cache. This means, that equal
XPath expressions, which differ only in white space are treated as
different cache entries. Special care is needed, if the XPath
expression includes namespace prefixes or references to tcl variables.
Both namespace prefixes and tcl variable references will be resolved
according to the XML prefix namespace mappings and tcl variable values
at expression compilation time. If the same XPath expression is used
................................................................................
        channelId.</p>

        <p>If the option <i class="m">-escapeNonASCII</i> is given,
        every non 7 bit ASCII character in attribute values or element
        PCDATA content will be escaped as character reference in
        decimal representation.</p>

        <p>The flag <i class="m">-xmlDeclaration</i> determines, whether there
        will be an XML Declaration and a newline emitted before
        anything else. The default is, to do not. If this flag is
        given with a true argument then</p>

        <p>
<i class="m">-encString</i> sets the encoding value in the XML
        Declaration. Otherwise, this option is ignored. Please note,
................................................................................
        <dd>Returns the DOM substree starting from the current node as the
root node of the result serialized acording to HTML rules (HTML elements are
recognized regardless of case, without end tags for emtpy HTML elements etc.),
as string or sends the output directly to the given channelId. If the option
<i class="m">-escapeNonASCII</i> is given, every non 7 bit ASCII character in attribute
values or element PCDATA content will be escaped as character reference in
decimal representation. If the option <i class="m">-htmlEntities</i> is given, a
character is outputed using a HTML 4.01 character entity reference, if one is
defined for it.</dd>
      

      
        <dt><b class="method">asText</b></dt>
          <dd>For ELEMENT_NODEs, the asText method outputs 
the string-value of every text node descendant of node in document
................................................................................

      
        <dt>
<b class="method">insertBeforeFromScript</b> <i class="m">tclScript</i> <i class="m">refChild</i>
</dt>
        <dd>Inserts the nodes created in the <i class="m">tclScript</i> by
Tcl functions, which have been built using <i class="m">dom createNodeCmd</i>, before the
<i class="m">refChild</i> into to the list of children of node. If <i class="m">refChild</i> is
the empty string, the new nodes will be appended.</dd>
      

      
        <dt>
<b class="method">appendXML</b> <i class="m">XMLstring</i>
</dt>
................................................................................
      

      
        <dt>
<b class="method">simpleTranslate</b> <i class="m">outputVar</i>
<i class="m">specifications</i>
</dt>
        <dd>Translate the subtree starting at the object node according to
the specifications in <i class="m">specifications</i> and outputs the result in the
variable <i class="m">outputVar</i> . The translation is very similar to Cost Simple
mode.</dd>
      

      
        <dt>
................................................................................
      

      
        <dt>
<b class="method">baseURI</b> <i class="m">?URI?</i>
</dt>
        <dd>Returns the present baseURI of the node. If the optional 
argument URI is given, sets the base URI of the node and of all of its child
nodes out of the same enitity as node to the given URI.</dd>
      

      
        <dt>
<b class="method">disableOutputEscaping</b> <i class="m">?boolean?</i>
</dt>
        <dd>This method works only for text nodes; for every other nodes it
returns error. Without the optional argument it returns, if disabling output
escaping is on. The return value 0 means, the characters of the text node will
be escaped, to generate valid XML, if serialized. This is the default for
every parsed or created text node (with the exception of that text nodes in a
result tree of an XSLT transformation, for which disabling output escaping was
requested explicitely in the stylesheet). The return value 1 means, that output
escaping is disabled for this text node. If such a text node is serialized
(with asXML or asHTML), it is literarily written, without escaping of the
special XML characters. If the optional boolean value <i class="m">boolean</i> is given,
the flag is set accordingly. You should not set this flag to 1, until you
really know, what you do.</dd>
      

      
        <dt>
<b class="method">precedes</b> <i class="m">refnode</i>
</dt>
        <dd>Compares the relative order of the node and <i class="m">refnode</i>. Both
nodes must be part of the same documents and not out of the fragment list of
the document. Returns true, if node is in document order (in the sense of the
XPath 1.0 recommendation) before <i class="m">refnode</i> and false otherwise.</dd>
      


      
        <dt>
<b class="method">normalize</b> <i class="m">?-forXPath?</i>
</dt>
................................................................................
<p>The optional <i class="m">-parameters</i> option sets top level
&lt;xsl:param&gt; to string values. The <i class="m">parameterList</i> has to be a tcl
list consisting of parameter name and value pairs.</p>

<p>If the option <i class="m">-ignoreUndeclaredParameters</i> is given, then parameter
names in the <i class="m">parameterList</i> given to the <i class="m">-parameters</i> options that
are not declared as top-level parameters in the stylesheet are silently
ignored. Without this option, an error is raised, if the user tries to set a
top-level parameter, which is not declared in the stylesheet.</p>

<p>The option <i class="m">-maxApplyDepth</i> expects a positiv integer as
argument. By default, the xslt engine allows xslt templates to nest up
to 3000 levels (and raises error if they nest deeper). This limit can
be set by the <i class="m">-maxApplyDepth</i> option.</p>

<p>The <i class="m">-xsltmessagecmd</i> option sets a callback for xslt:message elements
in the stylesheet. The actual command consists of the script, given as argument
to the option, appended with the XML Fragment from instantiating the
xsl:message element content as string (as if the XPath string() function would
have been applied to the XML Fragment) and a flag, which indicates, if the
xsl:message has an attribute "terminate" with the value "yes". If the
called script returns anything else then TCL_OK then the xslt
transformation will be aborted, returning error. If the called script
returns -code break, the error message is empty, otherwise the result
code is reported. In case of terminated transformation, the outputVar,
if given, is set to the empty string.</p>
</dd>
      

      
        <dt><i class="m">@attrName</i></dt>
        <dd>Returns the value of the attribute <i class="m">attrName</i>.  Short cut
................................................................................
      

    </dl><p>Otherwise, if an unknown method name is given, the command with the same
name as the given method within the namespace <tt class="l">::dom::domNode</tt> is tried to
be executed. This allows quick method additions on Tcl level.</p>


  <h2><a name="SECTid0xb81b10">SEE ALSO</a></h2><p class="seealso">dom, domDoc</p>
  
  <h2><a name="SECTid0xb81ea0">KEYWORDS</a></h2><p class="keywords">
<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>
</p>
  
</div><hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</body>
</html>


|



|


|




|

|







 







|







 







|







 







|







|







 







|
|







 







|









|
|
|
<
>
>







 







<
<
<
<
<
<
<
<
|

<
>
|







 







|







|







|








|








|

|







 







|







 







|








|







 







|







 







|







 







|







 







|







 







|







|







|

|
|








|
|







 







|
|

|








|



|
|







 







|

|




|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
..
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
..
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
...
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
...
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164

165
166
167
168
169
170
171
172
173
...
209
210
211
212
213
214
215








216
217

218
219
220
221
222
223
224
225
226
...
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
...
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
...
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
...
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
...
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
...
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
...
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
...
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
...
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
...
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
<html>
<head>
<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">
</head><body>
<div class="header">
<div class="navbar" align="center">
<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>
</div><hr class="navsep">
</div><div class="body">
  <h2><a name="SECTid0x1fa3230">NAME</a></h2><p class="namesection">
<b class="names">domNode - </b><br>Manipulates an instance of a DOM node object</p>



  <h2><a name="SECTid0x1e4dba0">SYNOPSIS</a></h2><pre class="syntax"> $nodeObject <i class="m">method</i>  <i class="m">arg arg ...</i>
</pre>
  <h2><a name="SECTid0x1f5bfd0"> DESCRIPTION </a></h2><p>This command manipulates one particular instance of a DOM node object.
<i class="m">method</i> indicates a specific method of the node class. These methods
should closely conform to the W3C recommendation "Document Object Model
(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>)
as well to parts of the W3C draft "XML Pointer Language (XPointer)"
(<a href="http://www.w3.org/TR/1998/WD-xptr-19980303">http://www.w3.org/TR/1998/WD-xptr-19980303</a>).
Please note, that the XPointer methods are deprecated. Use DOM methods
or XPath expressions instead of them.</p><p>The selectNodes method implements the "XML Path
................................................................................
optional argument <i class="m">newValue</i> is given, the node is set to that
value.</dd>

      

      
        <dt><b class="method">hasChildNodes</b></dt>
        <dd>Returns 1 if the node has children. Otherwise 0 is returned.</dd>
      

      
        <dt>
<b class="method">parentNode</b> <b class="variable">?objVar?</b>
</dt>
        <dd>Returns the parent node.</dd>
................................................................................
      
        <dt><b class="method">childNodesLive</b></dt>
        <dd>Returns a "live" nodeList object of the child nodes of
the node in the sense of the DOM recommendation. This nodeList object is
"live" in the sense that, for instance, changes to the children of
the node object that it was created from are immediately reflected in the nodes
returned by the NodeList accessors; it is not a static snapshot of the content
of the node. The two accessors known by the nodeList object are "item
&lt;index&gt;", which returns the indexth item in the collection, and
"length", which returns the number of nodes in the list.</dd>
      

      
        <dt>
<b class="method">firstChild</b> <b class="variable">?objVar?</b>
................................................................................
        <dd>Returns the last child as a node object.</dd>
      
      
      
        <dt>
<b class="method">nextSibling</b>  <b class="variable">?objVar?</b>
</dt>
        <dd>Returns the next sibling relative to the current node as a node
object.</dd>
      

      
        <dt>
<b class="method">previousSibling</b> <b class="variable">?objVar?</b>
</dt>
        <dd>Returns the next sibling relative to the current node as a node
object.</dd>
      

      
        <dt>
<b class="method">getElementsByTagName</b> <i class="m">name</i>
</dt>
................................................................................
<i class="m">uri</i>.</dd>
      

      
        <dt>
<b class="method">getElementById</b> <i class="m">id</i>
</dt>
        <dd>Returns the node having an id attribute with value
<i class="m">id</i> or the emtpy string if no node has an id attribute with that value.</dd>
      

      
        <dt>
<b class="method">hasAttribute</b> <i class="m">attributeName</i>
</dt>
        <dd>Returns 1 if the object node contains an attribute with name
................................................................................
<i class="m">attributeName</i> . Otherwise 0 is returned.</dd>
      

      
        <dt>
<b class="method">getAttribute</b> <i class="m">attributeName  ?defaultValue?</i>
</dt>
        <dd>Returns the value of the attribute <i class="m">attributeName</i>. If the
attribute is not available <i class="m">defaultValue</i> is returned.</dd>
      

      
        <dt>
<b class="method">setAttribute</b> <i class="m">attributeName newValue 
?attributeName newValue ...?</i>
</dt>
        <dd>Sets the value for one or more attributes. Every
        <i class="m">attributeName</i> is set to the corresponding
        <i class="m">newValue</i>. If there isn't an attribute for one or more
        of the <i class="m">attributeName</i>, this will create that attribute.

        It is not recommended to set attributes that look like xml
        namespace declarations.</dd>
      

      
        <dt>
<b class="method">removeAttribute</b> <i class="m">attributeName</i>
</dt>
        <dd>Removes the attribute <i class="m">attributeName</i>.</dd>
................................................................................
        <pre class="example">$node setAttributeNS "http://some.uri.com/wow" prefix:attr1 attrValue</pre>

<p>If the uri is the empty string and the attribute name hasn't a prefix, this
method has the same effect as the method <b>setAttribute</b>.</p>

        <pre class="example">$node setAttributeNS "" attri "some Value"</pre>









<p>With the exceptions of the special prefixes "xmlns" and "xml" you
always must provide a non emtpy <i class="m">uri</i>, if your <i class="m">qualifiedName</i> has a

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>
</dd>
      

      
        <dt>
<b class="method">removeAttributeNS</b> <i class="m">uri</i> <i class="m">localName</i>
</dt>
        <dd>Removes the attribute with the local name <i class="m">localName</i> within
................................................................................
      

      
        <dt>
<b class="method">attributes</b> <b class="option">?attributeNamePattern?</b>
</dt>
        <dd>Returns all attributes matching the <i class="m">attributeNamePattern</i>.
If <i class="m">attributeNamePattern</i> isn't given, all attributes are returned as a Tcl
list.</dd>
      

      
        <dt>
<b class="method">appendChild</b> <i class="m">newChild</i>
</dt>
        <dd>Appends <i class="m">newChild</i> to the end of the child list of the
node.</dd>
      

      
        <dt>
<b class="method">insertBefore</b> <i class="m">newChild</i>  <i class="m">refChild</i>
</dt>
        <dd>Inserts <i class="m">newChild</i> before the <i class="m">refChild</i> into the list of
children of node. If <i class="m">refChild</i> is the empty string, insert
<i class="m">newChild</i> at the end of the child nodes list of that node.</dd>
      

      
        <dt>
<b class="method">replaceChild</b> <i class="m">newChild</i>  <i class="m">oldChild</i>
</dt>
        <dd>Replaces <i class="m">oldChild</i> with <i class="m">newChild</i> in the list of
children of that node. The <i class="m">oldChild</i> node will be part of the
document fragment list after this operation.</dd>
      

      
        <dt>
<b class="method">removeChild</b> <i class="m">child</i>
</dt>
        <dd>Removes <i class="m">child</i> from the list of children of that node.
<i class="m">child</i> will be part of the document fragment list after this
operation.</dd>
      

      
        <dt><b class="method">delete</b></dt>
        <dd>Deletes the given node and its complete child tree
and frees the complete internal memory. The affected nodes are not accessible
through the document fragment list.</dd>
................................................................................
the XPath syntax to put an XPath variable. Ignoring the syntax rules of
XPath the Tcl variable name may be any legal Tcl var name: local
variables, global variables, array entries and so on. The value will
always be seen as string literal by the xpath engine. Cast the value
explicitly with the according xpath functions (number(), boolean()) to
another data type, if needed.</p>

<p>Similar to the way described above to inject literals in a secure
way into the XPath expression using tcl variable references there is a
syntax to inject element names from tcl variables. At every place
where the XPath syntax allows a node test there could be a tcl
variable reference (in any form), just the leading $ replaced with %.
This allows to select nodes with 'strange' (invalid, according to the
appropriate XML production rule) node names which may be needed in
case of working with JSON data.</p>
................................................................................
namespace prefix within the xpath expression will be first resolved
against the list of prefix / namespace pairs set with the
selectNodesNamespaces method for the document, the node belongs to. If
this fails, then the namespace definitions in scope of the context
node will be used to resolve the prefix. If this option is given, any
namespace prefix within the xpath expression will be first resolved
against that given list (and ignoring the document global prefix /
namespace list). If the list binds the same prefix to different
namespaces, then the first binding will win.  If this fails, then the
namespace definitions in scope of the context node will be used to
resolve the prefix, as usual.</p>

<p>If the <i class="m">-cache</i> option is used with a true value, then the
<i class="m">xpathQuery</i> will be looked up in a document specific cache. If
the query is found, then the stored pre-compiled query will be used.
If the query isn't found, it will be compiled and stored in the cache,
for use in further calls. Please note that the <i class="m">xpathQuery</i> 
given as string is used as key for the cache. This means, that equal
XPath expressions, which differ only in white space are treated as
different cache entries. Special care is needed, if the XPath
expression includes namespace prefixes or references to tcl variables.
Both namespace prefixes and tcl variable references will be resolved
according to the XML prefix namespace mappings and tcl variable values
at expression compilation time. If the same XPath expression is used
................................................................................
        channelId.</p>

        <p>If the option <i class="m">-escapeNonASCII</i> is given,
        every non 7 bit ASCII character in attribute values or element
        PCDATA content will be escaped as character reference in
        decimal representation.</p>

        <p>The flag <i class="m">-xmlDeclaration</i> determines whether there
        will be an XML Declaration and a newline emitted before
        anything else. The default is, to do not. If this flag is
        given with a true argument then</p>

        <p>
<i class="m">-encString</i> sets the encoding value in the XML
        Declaration. Otherwise, this option is ignored. Please note,
................................................................................
        <dd>Returns the DOM substree starting from the current node as the
root node of the result serialized acording to HTML rules (HTML elements are
recognized regardless of case, without end tags for emtpy HTML elements etc.),
as string or sends the output directly to the given channelId. If the option
<i class="m">-escapeNonASCII</i> is given, every non 7 bit ASCII character in attribute
values or element PCDATA content will be escaped as character reference in
decimal representation. If the option <i class="m">-htmlEntities</i> is given, a
character is written using its HTML 4.01 character entity reference, if one is
defined for it.</dd>
      

      
        <dt><b class="method">asText</b></dt>
          <dd>For ELEMENT_NODEs, the asText method outputs 
the string-value of every text node descendant of node in document
................................................................................

      
        <dt>
<b class="method">insertBeforeFromScript</b> <i class="m">tclScript</i> <i class="m">refChild</i>
</dt>
        <dd>Inserts the nodes created in the <i class="m">tclScript</i> by
Tcl functions, which have been built using <i class="m">dom createNodeCmd</i>, before the
<i class="m">refChild</i> into the list of children of node. If <i class="m">refChild</i> is
the empty string, the new nodes will be appended.</dd>
      

      
        <dt>
<b class="method">appendXML</b> <i class="m">XMLstring</i>
</dt>
................................................................................
      

      
        <dt>
<b class="method">simpleTranslate</b> <i class="m">outputVar</i>
<i class="m">specifications</i>
</dt>
        <dd>Translates the subtree starting at the object node according to
the specifications in <i class="m">specifications</i> and outputs the result in the
variable <i class="m">outputVar</i> . The translation is very similar to Cost Simple
mode.</dd>
      

      
        <dt>
................................................................................
      

      
        <dt>
<b class="method">baseURI</b> <i class="m">?URI?</i>
</dt>
        <dd>Returns the present baseURI of the node. If the optional 
argument URI is given, it sets the base URI of the node and of all of its child
nodes out of the same enitity as node to the given URI.</dd>
      

      
        <dt>
<b class="method">disableOutputEscaping</b> <i class="m">?boolean?</i>
</dt>
        <dd>This method works only for text nodes; for every other node it
returns error. Without the optional argument it returns, if disabling output
escaping is on. The return value 0 means, the characters of the text node will
be escaped, to generate valid XML, if serialized. This is the default for
every parsed or created text node (with the exception of that text nodes in a
result tree of an XSLT transformation, for which disabling output escaping was
requested explicitely in the stylesheet). The return value 1 means, that output
escaping is disabled for this text node. If such a text node is serialized
(with asXML or asHTML), it is literally written, without escaping of the
special XML characters. If the optional boolean value <i class="m">boolean</i> is given,
the flag is set accordingly. You should not set this flag to 1 until you
really know what you do.</dd>
      

      
        <dt>
<b class="method">precedes</b> <i class="m">refnode</i>
</dt>
        <dd>Compares the relative order of the node and <i class="m">refnode</i>. Both
nodes must be part of the same documents and not out of the fragment list of
the document. Returns true if node is in document order (in the sense of the
XPath 1.0 recommendation) before <i class="m">refnode</i>, and false otherwise.</dd>
      


      
        <dt>
<b class="method">normalize</b> <i class="m">?-forXPath?</i>
</dt>
................................................................................
<p>The optional <i class="m">-parameters</i> option sets top level
&lt;xsl:param&gt; to string values. The <i class="m">parameterList</i> has to be a tcl
list consisting of parameter name and value pairs.</p>

<p>If the option <i class="m">-ignoreUndeclaredParameters</i> is given, then parameter
names in the <i class="m">parameterList</i> given to the <i class="m">-parameters</i> options that
are not declared as top-level parameters in the stylesheet are silently
ignored. Without this option, an error is raised if the user tries to set a
top-level parameter which is not declared in the stylesheet.</p>

<p>The option <i class="m">-maxApplyDepth</i> expects a positive integer as
argument. By default, the xslt engine allows xslt templates to nest up
to 3000 levels (and raises error if they nest deeper). This limit can
be set by the <i class="m">-maxApplyDepth</i> option.</p>

<p>The <i class="m">-xsltmessagecmd</i> option sets a callback for xslt:message elements
in the stylesheet. The actual command consists of the script, given as argument
to the option, appended with the XML Fragment from instantiating the
xsl:message element content as string (as if the XPath string() function would
have been applied to the XML Fragment) and a flag, which indicates wether the
xsl:message has an attribute "terminate" with the value "yes". If the
called script returns anything else then TCL_OK then the xslt
transformation will be aborted, returning error. If the called script
returns -code break the error message is empty, otherwise the result
code is reported. In case of terminated transformation the outputVar,
if given, is set to the empty string.</p>
</dd>
      

      
        <dt><i class="m">@attrName</i></dt>
        <dd>Returns the value of the attribute <i class="m">attrName</i>.  Short cut
................................................................................
      

    </dl><p>Otherwise, if an unknown method name is given, the command with the same
name as the given method within the namespace <tt class="l">::dom::domNode</tt> is tried to
be executed. This allows quick method additions on Tcl level.</p>


  <h2><a name="SECTid0x1f86500">SEE ALSO</a></h2><p class="seealso">dom, domDoc</p>
  
  <h2><a name="SECTid0x1f86890">KEYWORDS</a></h2><p class="keywords">
<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>
</p>
  
</div><hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</body>
</html>

Changes to doc/domNode.n.

200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264


265
266
267
268
269
270
271
...
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321

322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
...
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
...
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
...
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
...
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
...
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
...
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
...
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
the data for element nodes of type TEXT_NODE, COMMENT_NODE,
PROCESSING_INSTRUCTION_NODE or CDATA_SECTION_NODE). Otherwise it is empty. If
the node is a TEXT_NODE, COMMENT_NODE or PROCESSING_INSTRUCTION_NODE and the
optional argument \fInewValue\fR is given, the node is set to that
value.
.TP
\&\fB\fBhasChildNodes\fP
\&\fRReturns 1 if the has children. Otherwise 0 is returned.
.TP
\&\fB\fBparentNode\fP \fB?objVar?\fP
\&\fRReturns the parent node.
.TP
\&\fB\fBchildNodes\fP
\&\fRReturns a list of direct children node objects.
.TP
\&\fB\fBchildNodesLive\fP
\&\fRReturns a "live" nodeList object of the child nodes of
the node in the sense of the DOM recommendation. This nodeList object is
"live" in the sense that, for instance, changes to the children of
the node object that it was created from are immediately reflected in the nodes
returned by the NodeList accessors; it is not a static snapshot of the content
of the node. The both accessors know by the nodeList object are "item
<index>", which returns the indexth item in the collection, and
"length", which returns the number of nodes in the list.
.TP
\&\fB\fBfirstChild\fP \fB?objVar?\fP
\&\fRReturns the first child as a node object.
.TP
\&\fB\fBlastChild\fP \fB?objVar?\fP
\&\fRReturns the last child as a node object.
.TP
\&\fB\fBnextSibling\fP  \fB?objVar?\fP
\&\fRReturns the next sibling relativ to the current node as a node
object.
.TP
\&\fB\fBpreviousSibling\fP \fB?objVar?\fP
\&\fRReturns the next sibling relativ to the current node as a node
object.
.TP
\&\fB\fBgetElementsByTagName\fP \fIname\fB
\&\fRReturns a list of all elements in the subtree matching (glob
style) \fIname\fR.
.TP
\&\fB\fBgetElementsByTagNameNS\fP \fIuri\fB \fIlocalname\fB
\&\fRReturns a list of all elements in the subtree
matching (glob style) \fIlocalname\fR and having the given namespace
\&\fIuri\fR.
.TP
\&\fB\fBgetElementById\fP \fIid\fB
\&\fRReturns the node having a id attribute with value
\&\fIid\fR or the emtpy string, if no node has an id attribute with that value.
.TP
\&\fB\fBhasAttribute\fP \fIattributeName\fB
\&\fRReturns 1 if the object node contains an attribute with name
\&\fIattributeName\fR . Otherwise 0 is returned.
.TP
\&\fB\fBgetAttribute\fP \fIattributeName  ?defaultValue?\fB
\&\fRReturns the value of the attribute \fIattributeName\fR. If
attribute is not available \fIdefaultValue\fR is returned.
.TP
\&\fB\fBsetAttribute\fP \fIattributeName newValue  ?attributeName newValue ...?\fB
\&\fRSets the value for one or more attributes. Every
\&\fIattributeName\fR is set to the corresponding \fInewValue\fR. If there
isn't an attribute for one or more of the \fIattributeName\fR this will
create that attribute.


.TP
\&\fB\fBremoveAttribute\fP \fIattributeName\fB
\&\fRRemoves the attribute \fIattributeName\fR.
.TP
\&\fB\fBhasAttributeNS\fP \fIuri\fB \fIlocalName\fB
\&\fRReturns 1 if the object node contains an attribute with the
local name \fIlocalName\fR within the namespace \fIuri\fR.  Otherwise 0 is
................................................................................


        
.CS
$node setAttributeNS "" attri "some Value"
.CE
.PP
XML namespace nodes are not in any namespace. Set them this way:


        
.CS
$node setAttributeNS "" xmlns:myprefix "myNamespaceURI"
$node setAttributeNS "" xmlns "newDefaultNamespace"
.CE
.PP
If your \fIqualifiedName\fR has the prefix "xml" and you give the empty
string as \fIuri\fR, the namespace of the attribute defaults to
"http://www.w3.org/XML/1998/namespace", as the DOM 2 recommendation
requests. With the exceptions of the special prefixes "xmlns" and "xml" you
always must provide a non emtpy \fIuri\fR, if your \fIqualifiedName\fR has a
prefix.

.RE
.TP
\&\fB\fBremoveAttributeNS\fP \fIuri\fB \fIlocalName\fB
\&\fRRemoves the attribute with the local name \fIlocalName\fR within
the namespace \fIuri\fR.
.TP
\&\fB\fBattributes\fP \fB?attributeNamePattern?\fP
\&\fRReturns all attributes matching the \fIattributeNamePattern\fR.
If \fIattributeNamePattern\fR isn't given all attributes are returned as a Tcl
list.
.TP
\&\fB\fBappendChild\fP \fInewChild\fB
\&\fRAppend \fInewChild\fR to the end of the child list of the
node.
.TP
\&\fB\fBinsertBefore\fP \fInewChild\fB  \fIrefChild\fB
\&\fRInsert \fInewChild\fR before the \fIrefChild\fR into the list of
children of node. If \fIrefChild\fR is the empty string, insert
\&\fInewChild\fR at the end of the child nodes list of that node.
.TP
\&\fB\fBreplaceChild\fP \fInewChild\fB  \fIoldChild\fB
\&\fRReplace \fIoldChild\fR with \fInewChild\fR in the list of
children of that node. The \fIoldChild\fR node will be part of the
document fragment list after this operation.
.TP
\&\fB\fBremoveChild\fP \fIchild\fB
\&\fRRemoves \fIchild\fR from the list of children of that node
\&\fIchild\fR will be part of the document fragment list after this
operation. It is not physically deleted.
.TP
\&\fB\fBdelete\fP
\&\fRDeletes the given node and its complete child tree
and frees the complete internal memory. The affected nodes are not accessible
through the document fragment list.
.TP
\&\fB\fBcloneNode\fP \fB?-deep?\fP
................................................................................
the XPath syntax to put an XPath variable. Ignoring the syntax rules of
XPath the Tcl variable name may be any legal Tcl var name: local
variables, global variables, array entries and so on. The value will
always be seen as string literal by the xpath engine. Cast the value
explicitly with the according xpath functions (number(), boolean()) to
another data type, if needed.
.PP
Simmilar to the above descibed way to inject literals in a secure
way into the XPath expression using tcl variable references there is a
syntax to inject element names from tcl variables. At every place
where the XPath syntax allows a node test there could be a tcl
variable reference (in any form), just the leading $ replaced with %.
This allows to select nodes with 'strange' (invalid, according to the
appropriate XML production rule) node names which may be needed in
case of working with JSON data.
................................................................................
namespace prefix within the xpath expression will be first resolved
against the list of prefix / namespace pairs set with the
selectNodesNamespaces method for the document, the node belongs to. If
this fails, then the namespace definitions in scope of the context
node will be used to resolve the prefix. If this option is given, any
namespace prefix within the xpath expression will be first resolved
against that given list (and ignoring the document global prefix /
namespace list). If the list bind the same prefix to different
namespaces, then the first binding will win.  If this fails, then the
namespace definitions in scope of the context node will be used to
resolve the prefix, as usual.
.PP
If the \fI-cache\fR option is used with a true value, then the
\&\fIxpathQuery\fR will be looked up in a document specific cache. If
the query is found, then the stored pre-compiled query will be used.
If the query isn't found, it will be compiled and stored in the cache,
for use in further calls. Please notice, that the \fIxpathQuery\fR as
given as string is used as key for the cache. This means, that equal
XPath expressions, which differ only in white space are treated as
different cache entries. Special care is needed, if the XPath
expression includes namespace prefixes or references to tcl variables.
Both namespace prefixes and tcl variable references will be resolved
according to the XML prefix namespace mappings and tcl variable values
at expression compilation time. If the same XPath expression is used
................................................................................
channelId.
.PP
If the option \fI-escapeNonASCII\fR is given,
every non 7 bit ASCII character in attribute values or element
PCDATA content will be escaped as character reference in
decimal representation.
.PP
The flag \fI-xmlDeclaration\fR determines, whether there
will be an XML Declaration and a newline emitted before
anything else. The default is, to do not. If this flag is
given with a true argument then
.PP
\&\fI-encString\fR sets the encoding value in the XML
Declaration. Otherwise, this option is ignored. Please note,
that this option just enhance the string representation of the
................................................................................
\&\fRReturns the DOM substree starting from the current node as the
root node of the result serialized acording to HTML rules (HTML elements are
recognized regardless of case, without end tags for emtpy HTML elements etc.),
as string or sends the output directly to the given channelId. If the option
\&\fI-escapeNonASCII\fR is given, every non 7 bit ASCII character in attribute
values or element PCDATA content will be escaped as character reference in
decimal representation. If the option \fI-htmlEntities\fR is given, a
character is outputed using a HTML 4.01 character entity reference, if one is
defined for it.
.TP
\&\fB\fBasText\fP
\&\fRFor ELEMENT_NODEs, the asText method outputs
the string-value of every text node descendant of node in document
order without any escaping. For every other node type, this method outputs the
the XPath string value of that node.
................................................................................
\&\fRAppends the nodes created in the \fItclScript\fR by
Tcl functions, which have been built using \fIdom createNodeCmd\fR, to the
given node.
.TP
\&\fB\fBinsertBeforeFromScript\fP \fItclScript\fB \fIrefChild\fB
\&\fRInserts the nodes created in the \fItclScript\fR by
Tcl functions, which have been built using \fIdom createNodeCmd\fR, before the
\&\fIrefChild\fR into to the list of children of node. If \fIrefChild\fR is
the empty string, the new nodes will be appended.
.TP
\&\fB\fBappendXML\fP \fIXMLstring\fB
\&\fRParses \fIXMLstring\fR, creates an according DOM subtree and
appends this subtree to the current node.
.TP
\&\fB\fBsimpleTranslate\fP \fIoutputVar\fB \fIspecifications\fB
\&\fRTranslate the subtree starting at the object node according to
the specifications in \fIspecifications\fR and outputs the result in the
variable \fIoutputVar\fR . The translation is very similar to Cost Simple
mode.
.TP
\&\fB\fBtoXPath\fP \fI?-legacy?\fB
\&\fRReturns an XPath, which exactly addresses the given
node in its document. This XPath is only valid as there are no changes to DOM
................................................................................
.TP
\&\fB\fBgetBaseURI\fP
\&\fRReturns the baseURI of the node. This method is deprecated in
favor of the \fIbaseURI\fR method.
.TP
\&\fB\fBbaseURI\fP \fI?URI?\fB
\&\fRReturns the present baseURI of the node. If the optional
argument URI is given, sets the base URI of the node and of all of its child
nodes out of the same enitity as node to the given URI.
.TP
\&\fB\fBdisableOutputEscaping\fP \fI?boolean?\fB
\&\fRThis method works only for text nodes; for every other nodes it
returns error. Without the optional argument it returns, if disabling output
escaping is on. The return value 0 means, the characters of the text node will
be escaped, to generate valid XML, if serialized. This is the default for
every parsed or created text node (with the exception of that text nodes in a
result tree of an XSLT transformation, for which disabling output escaping was
requested explicitely in the stylesheet). The return value 1 means, that output
escaping is disabled for this text node. If such a text node is serialized
(with asXML or asHTML), it is literarily written, without escaping of the
special XML characters. If the optional boolean value \fIboolean\fR is given,
the flag is set accordingly. You should not set this flag to 1, until you
really know, what you do.
.TP
\&\fB\fBprecedes\fP \fIrefnode\fB
\&\fRCompares the relative order of the node and \fIrefnode\fR. Both
nodes must be part of the same documents and not out of the fragment list of
the document. Returns true, if node is in document order (in the sense of the
XPath 1.0 recommendation) before \fIrefnode\fR and false otherwise.
.TP
\&\fB\fBnormalize\fP \fI?-forXPath?\fB
\&\fRPuts all Text nodes in the full depth of the sub-tree underneath
this Node into a "normal" form where only structure (e.g., elements,
comments, processing instructions and CDATA
sections) separates Text nodes, i.e., there
are neither adjacent Text nodes nor empty Text nodes. If the option
................................................................................
The optional \fI-parameters\fR option sets top level
<xsl:param> to string values. The \fIparameterList\fR has to be a tcl
list consisting of parameter name and value pairs.
.PP
If the option \fI-ignoreUndeclaredParameters\fR is given, then parameter
names in the \fIparameterList\fR given to the \fI-parameters\fR options that
are not declared as top-level parameters in the stylesheet are silently
ignored. Without this option, an error is raised, if the user tries to set a
top-level parameter, which is not declared in the stylesheet.
.PP
The option \fI-maxApplyDepth\fR expects a positiv integer as
argument. By default, the xslt engine allows xslt templates to nest up
to 3000 levels (and raises error if they nest deeper). This limit can
be set by the \fI-maxApplyDepth\fR option.
.PP
The \fI-xsltmessagecmd\fR option sets a callback for xslt:message elements
in the stylesheet. The actual command consists of the script, given as argument
to the option, appended with the XML Fragment from instantiating the
xsl:message element content as string (as if the XPath string() function would
have been applied to the XML Fragment) and a flag, which indicates, if the
xsl:message has an attribute "terminate" with the value "yes". If the
called script returns anything else then TCL_OK then the xslt
transformation will be aborted, returning error. If the called script
returns -code break, the error message is empty, otherwise the result
code is reported. In case of terminated transformation, the outputVar,
if given, is set to the empty string.
.RE
.TP
\&\fB\fI@attrName\fB
\&\fRReturns the value of the attribute \fIattrName\fR.  Short cut
for \fIgetAttribute\fR.
.TP







|













|










|



|












|
|






|




|
|
|
>
>







 







<
<
<
<
<
<
<
<
<
<
<
<
|

<
>








|



|



|




|




|

|







 







|







 







|








|







 







|







 







|







 







|







|







 







|



|







|

|
|




|
|







 







|
|

|








|



|
|







200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
...
302
303
304
305
306
307
308












309
310

311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
...
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
...
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
...
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
...
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
...
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
...
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
...
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
the data for element nodes of type TEXT_NODE, COMMENT_NODE,
PROCESSING_INSTRUCTION_NODE or CDATA_SECTION_NODE). Otherwise it is empty. If
the node is a TEXT_NODE, COMMENT_NODE or PROCESSING_INSTRUCTION_NODE and the
optional argument \fInewValue\fR is given, the node is set to that
value.
.TP
\&\fB\fBhasChildNodes\fP
\&\fRReturns 1 if the node has children. Otherwise 0 is returned.
.TP
\&\fB\fBparentNode\fP \fB?objVar?\fP
\&\fRReturns the parent node.
.TP
\&\fB\fBchildNodes\fP
\&\fRReturns a list of direct children node objects.
.TP
\&\fB\fBchildNodesLive\fP
\&\fRReturns a "live" nodeList object of the child nodes of
the node in the sense of the DOM recommendation. This nodeList object is
"live" in the sense that, for instance, changes to the children of
the node object that it was created from are immediately reflected in the nodes
returned by the NodeList accessors; it is not a static snapshot of the content
of the node. The two accessors known by the nodeList object are "item
<index>", which returns the indexth item in the collection, and
"length", which returns the number of nodes in the list.
.TP
\&\fB\fBfirstChild\fP \fB?objVar?\fP
\&\fRReturns the first child as a node object.
.TP
\&\fB\fBlastChild\fP \fB?objVar?\fP
\&\fRReturns the last child as a node object.
.TP
\&\fB\fBnextSibling\fP  \fB?objVar?\fP
\&\fRReturns the next sibling relative to the current node as a node
object.
.TP
\&\fB\fBpreviousSibling\fP \fB?objVar?\fP
\&\fRReturns the next sibling relative to the current node as a node
object.
.TP
\&\fB\fBgetElementsByTagName\fP \fIname\fB
\&\fRReturns a list of all elements in the subtree matching (glob
style) \fIname\fR.
.TP
\&\fB\fBgetElementsByTagNameNS\fP \fIuri\fB \fIlocalname\fB
\&\fRReturns a list of all elements in the subtree
matching (glob style) \fIlocalname\fR and having the given namespace
\&\fIuri\fR.
.TP
\&\fB\fBgetElementById\fP \fIid\fB
\&\fRReturns the node having an id attribute with value
\&\fIid\fR or the emtpy string if no node has an id attribute with that value.
.TP
\&\fB\fBhasAttribute\fP \fIattributeName\fB
\&\fRReturns 1 if the object node contains an attribute with name
\&\fIattributeName\fR . Otherwise 0 is returned.
.TP
\&\fB\fBgetAttribute\fP \fIattributeName  ?defaultValue?\fB
\&\fRReturns the value of the attribute \fIattributeName\fR. If the
attribute is not available \fIdefaultValue\fR is returned.
.TP
\&\fB\fBsetAttribute\fP \fIattributeName newValue  ?attributeName newValue ...?\fB
\&\fRSets the value for one or more attributes. Every
\&\fIattributeName\fR is set to the corresponding
\&\fInewValue\fR. If there isn't an attribute for one or more
of the \fIattributeName\fR, this will create that attribute.
It is not recommended to set attributes that look like xml
namespace declarations.
.TP
\&\fB\fBremoveAttribute\fP \fIattributeName\fB
\&\fRRemoves the attribute \fIattributeName\fR.
.TP
\&\fB\fBhasAttributeNS\fP \fIuri\fB \fIlocalName\fB
\&\fRReturns 1 if the object node contains an attribute with the
local name \fIlocalName\fR within the namespace \fIuri\fR.  Otherwise 0 is
................................................................................


        
.CS
$node setAttributeNS "" attri "some Value"
.CE
.PP












With the exceptions of the special prefixes "xmlns" and "xml" you
always must provide a non emtpy \fIuri\fR, if your \fIqualifiedName\fR has a

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.
.RE
.TP
\&\fB\fBremoveAttributeNS\fP \fIuri\fB \fIlocalName\fB
\&\fRRemoves the attribute with the local name \fIlocalName\fR within
the namespace \fIuri\fR.
.TP
\&\fB\fBattributes\fP \fB?attributeNamePattern?\fP
\&\fRReturns all attributes matching the \fIattributeNamePattern\fR.
If \fIattributeNamePattern\fR isn't given, all attributes are returned as a Tcl
list.
.TP
\&\fB\fBappendChild\fP \fInewChild\fB
\&\fRAppends \fInewChild\fR to the end of the child list of the
node.
.TP
\&\fB\fBinsertBefore\fP \fInewChild\fB  \fIrefChild\fB
\&\fRInserts \fInewChild\fR before the \fIrefChild\fR into the list of
children of node. If \fIrefChild\fR is the empty string, insert
\&\fInewChild\fR at the end of the child nodes list of that node.
.TP
\&\fB\fBreplaceChild\fP \fInewChild\fB  \fIoldChild\fB
\&\fRReplaces \fIoldChild\fR with \fInewChild\fR in the list of
children of that node. The \fIoldChild\fR node will be part of the
document fragment list after this operation.
.TP
\&\fB\fBremoveChild\fP \fIchild\fB
\&\fRRemoves \fIchild\fR from the list of children of that node.
\&\fIchild\fR will be part of the document fragment list after this
operation.
.TP
\&\fB\fBdelete\fP
\&\fRDeletes the given node and its complete child tree
and frees the complete internal memory. The affected nodes are not accessible
through the document fragment list.
.TP
\&\fB\fBcloneNode\fP \fB?-deep?\fP
................................................................................
the XPath syntax to put an XPath variable. Ignoring the syntax rules of
XPath the Tcl variable name may be any legal Tcl var name: local
variables, global variables, array entries and so on. The value will
always be seen as string literal by the xpath engine. Cast the value
explicitly with the according xpath functions (number(), boolean()) to
another data type, if needed.
.PP
Similar to the way described above to inject literals in a secure
way into the XPath expression using tcl variable references there is a
syntax to inject element names from tcl variables. At every place
where the XPath syntax allows a node test there could be a tcl
variable reference (in any form), just the leading $ replaced with %.
This allows to select nodes with 'strange' (invalid, according to the
appropriate XML production rule) node names which may be needed in
case of working with JSON data.
................................................................................
namespace prefix within the xpath expression will be first resolved
against the list of prefix / namespace pairs set with the
selectNodesNamespaces method for the document, the node belongs to. If
this fails, then the namespace definitions in scope of the context
node will be used to resolve the prefix. If this option is given, any
namespace prefix within the xpath expression will be first resolved
against that given list (and ignoring the document global prefix /
namespace list). If the list binds the same prefix to different
namespaces, then the first binding will win.  If this fails, then the
namespace definitions in scope of the context node will be used to
resolve the prefix, as usual.
.PP
If the \fI-cache\fR option is used with a true value, then the
\&\fIxpathQuery\fR will be looked up in a document specific cache. If
the query is found, then the stored pre-compiled query will be used.
If the query isn't found, it will be compiled and stored in the cache,
for use in further calls. Please note that the \fIxpathQuery\fR
given as string is used as key for the cache. This means, that equal
XPath expressions, which differ only in white space are treated as
different cache entries. Special care is needed, if the XPath
expression includes namespace prefixes or references to tcl variables.
Both namespace prefixes and tcl variable references will be resolved
according to the XML prefix namespace mappings and tcl variable values
at expression compilation time. If the same XPath expression is used
................................................................................
channelId.
.PP
If the option \fI-escapeNonASCII\fR is given,
every non 7 bit ASCII character in attribute values or element
PCDATA content will be escaped as character reference in
decimal representation.
.PP
The flag \fI-xmlDeclaration\fR determines whether there
will be an XML Declaration and a newline emitted before
anything else. The default is, to do not. If this flag is
given with a true argument then
.PP
\&\fI-encString\fR sets the encoding value in the XML
Declaration. Otherwise, this option is ignored. Please note,
that this option just enhance the string representation of the
................................................................................
\&\fRReturns the DOM substree starting from the current node as the
root node of the result serialized acording to HTML rules (HTML elements are
recognized regardless of case, without end tags for emtpy HTML elements etc.),
as string or sends the output directly to the given channelId. If the option
\&\fI-escapeNonASCII\fR is given, every non 7 bit ASCII character in attribute
values or element PCDATA content will be escaped as character reference in
decimal representation. If the option \fI-htmlEntities\fR is given, a
character is written using its HTML 4.01 character entity reference, if one is
defined for it.
.TP
\&\fB\fBasText\fP
\&\fRFor ELEMENT_NODEs, the asText method outputs
the string-value of every text node descendant of node in document
order without any escaping. For every other node type, this method outputs the
the XPath string value of that node.
................................................................................
\&\fRAppends the nodes created in the \fItclScript\fR by
Tcl functions, which have been built using \fIdom createNodeCmd\fR, to the
given node.
.TP
\&\fB\fBinsertBeforeFromScript\fP \fItclScript\fB \fIrefChild\fB
\&\fRInserts the nodes created in the \fItclScript\fR by
Tcl functions, which have been built using \fIdom createNodeCmd\fR, before the
\&\fIrefChild\fR into the list of children of node. If \fIrefChild\fR is
the empty string, the new nodes will be appended.
.TP
\&\fB\fBappendXML\fP \fIXMLstring\fB
\&\fRParses \fIXMLstring\fR, creates an according DOM subtree and
appends this subtree to the current node.
.TP
\&\fB\fBsimpleTranslate\fP \fIoutputVar\fB \fIspecifications\fB
\&\fRTranslates the subtree starting at the object node according to
the specifications in \fIspecifications\fR and outputs the result in the
variable \fIoutputVar\fR . The translation is very similar to Cost Simple
mode.
.TP
\&\fB\fBtoXPath\fP \fI?-legacy?\fB
\&\fRReturns an XPath, which exactly addresses the given
node in its document. This XPath is only valid as there are no changes to DOM
................................................................................
.TP
\&\fB\fBgetBaseURI\fP
\&\fRReturns the baseURI of the node. This method is deprecated in
favor of the \fIbaseURI\fR method.
.TP
\&\fB\fBbaseURI\fP \fI?URI?\fB
\&\fRReturns the present baseURI of the node. If the optional
argument URI is given, it sets the base URI of the node and of all of its child
nodes out of the same enitity as node to the given URI.
.TP
\&\fB\fBdisableOutputEscaping\fP \fI?boolean?\fB
\&\fRThis method works only for text nodes; for every other node it
returns error. Without the optional argument it returns, if disabling output
escaping is on. The return value 0 means, the characters of the text node will
be escaped, to generate valid XML, if serialized. This is the default for
every parsed or created text node (with the exception of that text nodes in a
result tree of an XSLT transformation, for which disabling output escaping was
requested explicitely in the stylesheet). The return value 1 means, that output
escaping is disabled for this text node. If such a text node is serialized
(with asXML or asHTML), it is literally written, without escaping of the
special XML characters. If the optional boolean value \fIboolean\fR is given,
the flag is set accordingly. You should not set this flag to 1 until you
really know what you do.
.TP
\&\fB\fBprecedes\fP \fIrefnode\fB
\&\fRCompares the relative order of the node and \fIrefnode\fR. Both
nodes must be part of the same documents and not out of the fragment list of
the document. Returns true if node is in document order (in the sense of the
XPath 1.0 recommendation) before \fIrefnode\fR, and false otherwise.
.TP
\&\fB\fBnormalize\fP \fI?-forXPath?\fB
\&\fRPuts all Text nodes in the full depth of the sub-tree underneath
this Node into a "normal" form where only structure (e.g., elements,
comments, processing instructions and CDATA
sections) separates Text nodes, i.e., there
are neither adjacent Text nodes nor empty Text nodes. If the option
................................................................................
The optional \fI-parameters\fR option sets top level
<xsl:param> to string values. The \fIparameterList\fR has to be a tcl
list consisting of parameter name and value pairs.
.PP
If the option \fI-ignoreUndeclaredParameters\fR is given, then parameter
names in the \fIparameterList\fR given to the \fI-parameters\fR options that
are not declared as top-level parameters in the stylesheet are silently
ignored. Without this option, an error is raised if the user tries to set a
top-level parameter which is not declared in the stylesheet.
.PP
The option \fI-maxApplyDepth\fR expects a positive integer as
argument. By default, the xslt engine allows xslt templates to nest up
to 3000 levels (and raises error if they nest deeper). This limit can
be set by the \fI-maxApplyDepth\fR option.
.PP
The \fI-xsltmessagecmd\fR option sets a callback for xslt:message elements
in the stylesheet. The actual command consists of the script, given as argument
to the option, appended with the XML Fragment from instantiating the
xsl:message element content as string (as if the XPath string() function would
have been applied to the XML Fragment) and a flag, which indicates wether the
xsl:message has an attribute "terminate" with the value "yes". If the
called script returns anything else then TCL_OK then the xslt
transformation will be aborted, returning error. If the called script
returns -code break the error message is empty, otherwise the result
code is reported. In case of terminated transformation the outputVar,
if given, is set to the empty string.
.RE
.TP
\&\fB\fI@attrName\fB
\&\fRReturns the value of the attribute \fIattrName\fR.  Short cut
for \fIgetAttribute\fR.
.TP

Changes to doc/domNode.xml.

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
...
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
...
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
...
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
...
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
...
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
...
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
...
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
...
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
...
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
optional argument <m>newValue</m> is given, the node is set to that
value.</desc>

      </commanddef>

      <commanddef>
        <command><method>hasChildNodes</method></command>
        <desc>Returns 1 if the has children. Otherwise 0 is returned.</desc>
      </commanddef>

      <commanddef>
        <command><method>parentNode</method> <variable>?objVar?</variable></command>
        <desc>Returns the parent node.</desc>
      </commanddef>

................................................................................
      <commanddef>
        <command><method>childNodesLive</method></command>
        <desc>Returns a &quot;live&quot; nodeList object of the child nodes of
the node in the sense of the DOM recommendation. This nodeList object is
&quot;live&quot; in the sense that, for instance, changes to the children of
the node object that it was created from are immediately reflected in the nodes
returned by the NodeList accessors; it is not a static snapshot of the content
of the node. The both accessors know by the nodeList object are &quot;item
&lt;index&gt;&quot;, which returns the indexth item in the collection, and
&quot;length&quot;, which returns the number of nodes in the list.</desc>
      </commanddef>

      <commanddef>
        <command><method>firstChild</method> <variable>?objVar?</variable></command>
        <desc>Returns the first child as a node object.</desc>
................................................................................
      <commanddef>
        <command><method>lastChild</method> <variable>?objVar?</variable></command>
        <desc>Returns the last child as a node object.</desc>
      </commanddef>
      
      <commanddef>
        <command><method>nextSibling</method>  <variable>?objVar?</variable></command>
        <desc>Returns the next sibling relativ to the current node as a node
object.</desc>
      </commanddef>

      <commanddef>
        <command><method>previousSibling</method> <variable>?objVar?</variable></command>
        <desc>Returns the next sibling relativ to the current node as a node
object.</desc>
      </commanddef>

      <commanddef>
        <command><method>getElementsByTagName</method> <m>name</m></command>
        <desc>Returns a list of all elements in the subtree matching (glob
style) <m>name</m>.</desc>
................................................................................
        <desc>Returns a list of all elements in the subtree
matching (glob style) <m>localname</m> and having the given namespace
<m>uri</m>.</desc>
      </commanddef>

      <commanddef>
        <command><method>getElementById</method> <m>id</m></command>
        <desc>Returns the node having a id attribute with value
<m>id</m> or the emtpy string, if no node has an id attribute with that value.</desc>
      </commanddef>

      <commanddef>
        <command><method>hasAttribute</method> <m>attributeName</m></command>
        <desc>Returns 1 if the object node contains an attribute with name
<m>attributeName</m> . Otherwise 0 is returned.</desc>
      </commanddef>

      <commanddef>
        <command><method>getAttribute</method> <m>attributeName  ?defaultValue?</m></command>
        <desc>Returns the value of the attribute <m>attributeName</m>. If
attribute is not available <m>defaultValue</m> is returned.</desc>
      </commanddef>

      <commanddef>
        <command><method>setAttribute</method> <m>attributeName newValue 
?attributeName newValue ...?</m></command>
        <desc>Sets the value for one or more attributes. Every
        <m>attributeName</m> is set to the corresponding
        <m>newValue</m>. If there isn't an attribute for one or more
        of the <m>attributeName</m> this will create that attribute.
        It is not recommended to set attributes that look like xml
        namespace declarations.</desc>

      </commanddef>

      <commanddef>
        <command><method>removeAttribute</method> <m>attributeName</m></command>
        <desc>Removes the attribute <m>attributeName</m>.</desc>
      </commanddef>

................................................................................
        <desc>Removes the attribute with the local name <m>localName</m> within
 the namespace <m>uri</m>.</desc>
      </commanddef>

      <commanddef>
        <command><method>attributes</method> <option>?attributeNamePattern?</option></command>
        <desc>Returns all attributes matching the <m>attributeNamePattern</m>.
If <m>attributeNamePattern</m> isn't given all attributes are returned as a Tcl
list.</desc>
      </commanddef>

      <commanddef>
        <command><method>appendChild</method> <m>newChild</m></command>
        <desc>Append <m>newChild</m> to the end of the child list of the
node.</desc>
      </commanddef>

      <commanddef>
        <command><method>insertBefore</method> <m>newChild</m>  <m>refChild</m></command>
        <desc>Insert <m>newChild</m> before the <m>refChild</m> into the list of
children of node. If <m>refChild</m> is the empty string, insert
<m>newChild</m> at the end of the child nodes list of that node.</desc>
      </commanddef>

      <commanddef>
        <command><method>replaceChild</method> <m>newChild</m>  <m>oldChild</m></command>
        <desc>Replace <m>oldChild</m> with <m>newChild</m> in the list of
children of that node. The <m>oldChild</m> node will be part of the
document fragment list after this operation.</desc>
      </commanddef>

      <commanddef>
        <command><method>removeChild</method> <m>child</m></command>
        <desc>Removes <m>child</m> from the list of children of that node
<m>child</m> will be part of the document fragment list after this
operation. It is not physically deleted.</desc>
      </commanddef>

      <commanddef>
        <command><method>delete</method></command>
        <desc>Deletes the given node and its complete child tree
and frees the complete internal memory. The affected nodes are not accessible
through the document fragment list.</desc>
................................................................................
the XPath syntax to put an XPath variable. Ignoring the syntax rules of
XPath the Tcl variable name may be any legal Tcl var name: local
variables, global variables, array entries and so on. The value will
always be seen as string literal by the xpath engine. Cast the value
explicitly with the according xpath functions (number(), boolean()) to
another data type, if needed.</p>

<p>Simmilar to the above descibed way to inject literals in a secure
way into the XPath expression using tcl variable references there is a
syntax to inject element names from tcl variables. At every place
where the XPath syntax allows a node test there could be a tcl
variable reference (in any form), just the leading $ replaced with %.
This allows to select nodes with 'strange' (invalid, according to the
appropriate XML production rule) node names which may be needed in
case of working with JSON data.</p>
................................................................................
namespace prefix within the xpath expression will be first resolved
against the list of prefix / namespace pairs set with the
selectNodesNamespaces method for the document, the node belongs to. If
this fails, then the namespace definitions in scope of the context
node will be used to resolve the prefix. If this option is given, any
namespace prefix within the xpath expression will be first resolved
against that given list (and ignoring the document global prefix /
namespace list). If the list bind the same prefix to different
namespaces, then the first binding will win.  If this fails, then the
namespace definitions in scope of the context node will be used to
resolve the prefix, as usual.</p>

<p>If the <m>-cache</m> option is used with a true value, then the
<m>xpathQuery</m> will be looked up in a document specific cache. If
the query is found, then the stored pre-compiled query will be used.
If the query isn't found, it will be compiled and stored in the cache,
for use in further calls. Please notice, that the <m>xpathQuery</m> as
given as string is used as key for the cache. This means, that equal
XPath expressions, which differ only in white space are treated as
different cache entries. Special care is needed, if the XPath
expression includes namespace prefixes or references to tcl variables.
Both namespace prefixes and tcl variable references will be resolved
according to the XML prefix namespace mappings and tcl variable values
at expression compilation time. If the same XPath expression is used
................................................................................
        channelId.</p>

        <p>If the option <m>-escapeNonASCII</m> is given,
        every non 7 bit ASCII character in attribute values or element
        PCDATA content will be escaped as character reference in
        decimal representation.</p>

        <p>The flag <m>-xmlDeclaration</m> determines, whether there
        will be an XML Declaration and a newline emitted before
        anything else. The default is, to do not. If this flag is
        given with a true argument then</p>

        <p><m>-encString</m> sets the encoding value in the XML
        Declaration. Otherwise, this option is ignored. Please note,
        that this option just enhance the string representation of the
................................................................................
        <desc>Returns the DOM substree starting from the current node as the
root node of the result serialized acording to HTML rules (HTML elements are
recognized regardless of case, without end tags for emtpy HTML elements etc.),
as string or sends the output directly to the given channelId. If the option
<m>-escapeNonASCII</m> is given, every non 7 bit ASCII character in attribute
values or element PCDATA content will be escaped as character reference in
decimal representation. If the option <m>-htmlEntities</m> is given, a
character is outputed using a HTML 4.01 character entity reference, if one is
defined for it.</desc>
      </commanddef>

      <commanddef>
        <command><method>asText</method></command>
          <desc>For ELEMENT_NODEs, the asText method outputs 
the string-value of every text node descendant of node in document
................................................................................
given node.</desc>
      </commanddef>

      <commanddef>
        <command><method>insertBeforeFromScript</method> <m>tclScript</m> <m>refChild</m></command>
        <desc>Inserts the nodes created in the <m>tclScript</m> by
Tcl functions, which have been built using <m>dom createNodeCmd</m>, before the
<m>refChild</m> into to the list of children of node. If <m>refChild</m> is
the empty string, the new nodes will be appended.</desc>
      </commanddef>

      <commanddef>
        <command><method>appendXML</method> <m>XMLstring</m></command>
        <desc>Parses <m>XMLstring</m>, creates an according DOM subtree and
appends this subtree to the current node.</desc>
      </commanddef>

      <commanddef>
        <command><method>simpleTranslate</method> <m>outputVar</m>
<m>specifications</m></command>
        <desc>Translate the subtree starting at the object node according to
the specifications in <m>specifications</m> and outputs the result in the
variable <m>outputVar</m> . The translation is very similar to Cost Simple
mode.</desc>
      </commanddef>

      <commanddef>
        <command><method>toXPath</method> <m>?-legacy?</m></command>
................................................................................
        <desc>Returns the baseURI of the node. This method is deprecated in
          favor of the <m>baseURI</m> method.</desc>
      </commanddef>

      <commanddef>
        <command><method>baseURI</method> <m>?URI?</m></command>
        <desc>Returns the present baseURI of the node. If the optional 
argument URI is given, sets the base URI of the node and of all of its child
nodes out of the same enitity as node to the given URI.</desc>
      </commanddef>

      <commanddef>
        <command><method>disableOutputEscaping</method> <m>?boolean?</m></command>
        <desc>This method works only for text nodes; for every other nodes it
returns error. Without the optional argument it returns, if disabling output
escaping is on. The return value 0 means, the characters of the text node will
be escaped, to generate valid XML, if serialized. This is the default for
every parsed or created text node (with the exception of that text nodes in a
result tree of an XSLT transformation, for which disabling output escaping was
requested explicitely in the stylesheet). The return value 1 means, that output
escaping is disabled for this text node. If such a text node is serialized
(with asXML or asHTML), it is literarily written, without escaping of the
special XML characters. If the optional boolean value <m>boolean</m> is given,
the flag is set accordingly. You should not set this flag to 1, until you
really know, what you do.</desc>
      </commanddef>

      <commanddef>
        <command><method>precedes</method> <m>refnode</m></command>
        <desc>Compares the relative order of the node and <m>refnode</m>. Both
nodes must be part of the same documents and not out of the fragment list of
the document. Returns true, if node is in document order (in the sense of the
XPath 1.0 recommendation) before <m>refnode</m> and false otherwise.</desc>
      </commanddef>


      <commanddef>
        <command><method>normalize</method> <m>?-forXPath?</m></command>
        <desc>Puts all Text nodes in the full depth of the sub-tree underneath
this Node into a "normal" form where only structure (e.g., elements,
................................................................................
<p>The optional <m>-parameters</m> option sets top level
&lt;xsl:param&gt; to string values. The <m>parameterList</m> has to be a tcl
list consisting of parameter name and value pairs.</p>

<p>If the option <m>-ignoreUndeclaredParameters</m> is given, then parameter
names in the <m>parameterList</m> given to the <m>-parameters</m> options that
are not declared as top-level parameters in the stylesheet are silently
ignored. Without this option, an error is raised, if the user tries to set a
top-level parameter, which is not declared in the stylesheet.</p>

<p>The option <m>-maxApplyDepth</m> expects a positiv integer as
argument. By default, the xslt engine allows xslt templates to nest up
to 3000 levels (and raises error if they nest deeper). This limit can
be set by the <m>-maxApplyDepth</m> option.</p>

<p>The <m>-xsltmessagecmd</m> option sets a callback for xslt:message elements
in the stylesheet. The actual command consists of the script, given as argument
to the option, appended with the XML Fragment from instantiating the
xsl:message element content as string (as if the XPath string() function would
have been applied to the XML Fragment) and a flag, which indicates, if the
xsl:message has an attribute "terminate" with the value "yes". If the
called script returns anything else then TCL_OK then the xslt
transformation will be aborted, returning error. If the called script
returns -code break, the error message is empty, otherwise the result
code is reported. In case of terminated transformation, the outputVar,
if given, is set to the empty string.</p>
</desc>
      </commanddef>

      <commanddef>
        <command><m>@attrName</m></command>
        <desc>Returns the value of the attribute <m>attrName</m>.  Short cut







|







 







|







 







|





|







 







|
|










|









|


<







 







|





|





|






|






|

|







 







|







 







|








|







 







|







 







|







 







|












|







 







|





|







|

|
|






|
|







 







|
|

|








|



|
|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
...
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

158
159
160
161
162
163
164
...
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
...
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
...
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
...
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
...
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
...
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
...
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
...
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
optional argument <m>newValue</m> is given, the node is set to that
value.</desc>

      </commanddef>

      <commanddef>
        <command><method>hasChildNodes</method></command>
        <desc>Returns 1 if the node has children. Otherwise 0 is returned.</desc>
      </commanddef>

      <commanddef>
        <command><method>parentNode</method> <variable>?objVar?</variable></command>
        <desc>Returns the parent node.</desc>
      </commanddef>

................................................................................
      <commanddef>
        <command><method>childNodesLive</method></command>
        <desc>Returns a &quot;live&quot; nodeList object of the child nodes of
the node in the sense of the DOM recommendation. This nodeList object is
&quot;live&quot; in the sense that, for instance, changes to the children of
the node object that it was created from are immediately reflected in the nodes
returned by the NodeList accessors; it is not a static snapshot of the content
of the node. The two accessors known by the nodeList object are &quot;item
&lt;index&gt;&quot;, which returns the indexth item in the collection, and
&quot;length&quot;, which returns the number of nodes in the list.</desc>
      </commanddef>

      <commanddef>
        <command><method>firstChild</method> <variable>?objVar?</variable></command>
        <desc>Returns the first child as a node object.</desc>
................................................................................
      <commanddef>
        <command><method>lastChild</method> <variable>?objVar?</variable></command>
        <desc>Returns the last child as a node object.</desc>
      </commanddef>
      
      <commanddef>
        <command><method>nextSibling</method>  <variable>?objVar?</variable></command>
        <desc>Returns the next sibling relative to the current node as a node
object.</desc>
      </commanddef>

      <commanddef>
        <command><method>previousSibling</method> <variable>?objVar?</variable></command>
        <desc>Returns the next sibling relative to the current node as a node
object.</desc>
      </commanddef>

      <commanddef>
        <command><method>getElementsByTagName</method> <m>name</m></command>
        <desc>Returns a list of all elements in the subtree matching (glob
style) <m>name</m>.</desc>
................................................................................
        <desc>Returns a list of all elements in the subtree
matching (glob style) <m>localname</m> and having the given namespace
<m>uri</m>.</desc>
      </commanddef>

      <commanddef>
        <command><method>getElementById</method> <m>id</m></command>
        <desc>Returns the node having an id attribute with value
<m>id</m> or the emtpy string if no node has an id attribute with that value.</desc>
      </commanddef>

      <commanddef>
        <command><method>hasAttribute</method> <m>attributeName</m></command>
        <desc>Returns 1 if the object node contains an attribute with name
<m>attributeName</m> . Otherwise 0 is returned.</desc>
      </commanddef>

      <commanddef>
        <command><method>getAttribute</method> <m>attributeName  ?defaultValue?</m></command>
        <desc>Returns the value of the attribute <m>attributeName</m>. If the
attribute is not available <m>defaultValue</m> is returned.</desc>
      </commanddef>

      <commanddef>
        <command><method>setAttribute</method> <m>attributeName newValue 
?attributeName newValue ...?</m></command>
        <desc>Sets the value for one or more attributes. Every
        <m>attributeName</m> is set to the corresponding
        <m>newValue</m>. If there isn't an attribute for one or more
        of the <m>attributeName</m>, this will create that attribute.
        It is not recommended to set attributes that look like xml
        namespace declarations.</desc>

      </commanddef>

      <commanddef>
        <command><method>removeAttribute</method> <m>attributeName</m></command>
        <desc>Removes the attribute <m>attributeName</m>.</desc>
      </commanddef>

................................................................................
        <desc>Removes the attribute with the local name <m>localName</m> within
 the namespace <m>uri</m>.</desc>
      </commanddef>

      <commanddef>
        <command><method>attributes</method> <option>?attributeNamePattern?</option></command>
        <desc>Returns all attributes matching the <m>attributeNamePattern</m>.
If <m>attributeNamePattern</m> isn't given, all attributes are returned as a Tcl
list.</desc>
      </commanddef>

      <commanddef>
        <command><method>appendChild</method> <m>newChild</m></command>
        <desc>Appends <m>newChild</m> to the end of the child list of the
node.</desc>
      </commanddef>

      <commanddef>
        <command><method>insertBefore</method> <m>newChild</m>  <m>refChild</m></command>
        <desc>Inserts <m>newChild</m> before the <m>refChild</m> into the list of
children of node. If <m>refChild</m> is the empty string, insert
<m>newChild</m> at the end of the child nodes list of that node.</desc>
      </commanddef>

      <commanddef>
        <command><method>replaceChild</method> <m>newChild</m>  <m>oldChild</m></command>
        <desc>Replaces <m>oldChild</m> with <m>newChild</m> in the list of
children of that node. The <m>oldChild</m> node will be part of the
document fragment list after this operation.</desc>
      </commanddef>

      <commanddef>
        <command><method>removeChild</method> <m>child</m></command>
        <desc>Removes <m>child</m> from the list of children of that node.
<m>child</m> will be part of the document fragment list after this
operation.</desc>
      </commanddef>

      <commanddef>
        <command><method>delete</method></command>
        <desc>Deletes the given node and its complete child tree
and frees the complete internal memory. The affected nodes are not accessible
through the document fragment list.</desc>
................................................................................
the XPath syntax to put an XPath variable. Ignoring the syntax rules of
XPath the Tcl variable name may be any legal Tcl var name: local
variables, global variables, array entries and so on. The value will
always be seen as string literal by the xpath engine. Cast the value
explicitly with the according xpath functions (number(), boolean()) to
another data type, if needed.</p>

<p>Similar to the way described above to inject literals in a secure
way into the XPath expression using tcl variable references there is a
syntax to inject element names from tcl variables. At every place
where the XPath syntax allows a node test there could be a tcl
variable reference (in any form), just the leading $ replaced with %.
This allows to select nodes with 'strange' (invalid, according to the
appropriate XML production rule) node names which may be needed in
case of working with JSON data.</p>
................................................................................
namespace prefix within the xpath expression will be first resolved
against the list of prefix / namespace pairs set with the
selectNodesNamespaces method for the document, the node belongs to. If
this fails, then the namespace definitions in scope of the context
node will be used to resolve the prefix. If this option is given, any
namespace prefix within the xpath expression will be first resolved
against that given list (and ignoring the document global prefix /
namespace list). If the list binds the same prefix to different
namespaces, then the first binding will win.  If this fails, then the
namespace definitions in scope of the context node will be used to
resolve the prefix, as usual.</p>

<p>If the <m>-cache</m> option is used with a true value, then the
<m>xpathQuery</m> will be looked up in a document specific cache. If
the query is found, then the stored pre-compiled query will be used.
If the query isn't found, it will be compiled and stored in the cache,
for use in further calls. Please note that the <m>xpathQuery</m> 
given as string is used as key for the cache. This means, that equal
XPath expressions, which differ only in white space are treated as
different cache entries. Special care is needed, if the XPath
expression includes namespace prefixes or references to tcl variables.
Both namespace prefixes and tcl variable references will be resolved
according to the XML prefix namespace mappings and tcl variable values
at expression compilation time. If the same XPath expression is used
................................................................................
        channelId.</p>

        <p>If the option <m>-escapeNonASCII</m> is given,
        every non 7 bit ASCII character in attribute values or element
        PCDATA content will be escaped as character reference in
        decimal representation.</p>

        <p>The flag <m>-xmlDeclaration</m> determines whether there
        will be an XML Declaration and a newline emitted before
        anything else. The default is, to do not. If this flag is
        given with a true argument then</p>

        <p><m>-encString</m> sets the encoding value in the XML
        Declaration. Otherwise, this option is ignored. Please note,
        that this option just enhance the string representation of the
................................................................................
        <desc>Returns the DOM substree starting from the current node as the
root node of the result serialized acording to HTML rules (HTML elements are
recognized regardless of case, without end tags for emtpy HTML elements etc.),
as string or sends the output directly to the given channelId. If the option
<m>-escapeNonASCII</m> is given, every non 7 bit ASCII character in attribute
values or element PCDATA content will be escaped as character reference in
decimal representation. If the option <m>-htmlEntities</m> is given, a
character is written using its HTML 4.01 character entity reference, if one is
defined for it.</desc>
      </commanddef>

      <commanddef>
        <command><method>asText</method></command>
          <desc>For ELEMENT_NODEs, the asText method outputs 
the string-value of every text node descendant of node in document
................................................................................
given node.</desc>
      </commanddef>

      <commanddef>
        <command><method>insertBeforeFromScript</method> <m>tclScript</m> <m>refChild</m></command>
        <desc>Inserts the nodes created in the <m>tclScript</m> by
Tcl functions, which have been built using <m>dom createNodeCmd</m>, before the
<m>refChild</m> into the list of children of node. If <m>refChild</m> is
the empty string, the new nodes will be appended.</desc>
      </commanddef>

      <commanddef>
        <command><method>appendXML</method> <m>XMLstring</m></command>
        <desc>Parses <m>XMLstring</m>, creates an according DOM subtree and
appends this subtree to the current node.</desc>
      </commanddef>

      <commanddef>
        <command><method>simpleTranslate</method> <m>outputVar</m>
<m>specifications</m></command>
        <desc>Translates the subtree starting at the object node according to
the specifications in <m>specifications</m> and outputs the result in the
variable <m>outputVar</m> . The translation is very similar to Cost Simple
mode.</desc>
      </commanddef>

      <commanddef>
        <command><method>toXPath</method> <m>?-legacy?</m></command>
................................................................................
        <desc>Returns the baseURI of the node. This method is deprecated in
          favor of the <m>baseURI</m> method.</desc>
      </commanddef>

      <commanddef>
        <command><method>baseURI</method> <m>?URI?</m></command>
        <desc>Returns the present baseURI of the node. If the optional 
argument URI is given, it sets the base URI of the node and of all of its child
nodes out of the same enitity as node to the given URI.</desc>
      </commanddef>

      <commanddef>
        <command><method>disableOutputEscaping</method> <m>?boolean?</m></command>
        <desc>This method works only for text nodes; for every other node it
returns error. Without the optional argument it returns, if disabling output
escaping is on. The return value 0 means, the characters of the text node will
be escaped, to generate valid XML, if serialized. This is the default for
every parsed or created text node (with the exception of that text nodes in a
result tree of an XSLT transformation, for which disabling output escaping was
requested explicitely in the stylesheet). The return value 1 means, that output
escaping is disabled for this text node. If such a text node is serialized
(with asXML or asHTML), it is literally written, without escaping of the
special XML characters. If the optional boolean value <m>boolean</m> is given,
the flag is set accordingly. You should not set this flag to 1 until you
really know what you do.</desc>
      </commanddef>

      <commanddef>
        <command><method>precedes</method> <m>refnode</m></command>
        <desc>Compares the relative order of the node and <m>refnode</m>. Both
nodes must be part of the same documents and not out of the fragment list of
the document. Returns true if node is in document order (in the sense of the
XPath 1.0 recommendation) before <m>refnode</m>, and false otherwise.</desc>
      </commanddef>


      <commanddef>
        <command><method>normalize</method> <m>?-forXPath?</m></command>
        <desc>Puts all Text nodes in the full depth of the sub-tree underneath
this Node into a "normal" form where only structure (e.g., elements,
................................................................................
<p>The optional <m>-parameters</m> option sets top level
&lt;xsl:param&gt; to string values. The <m>parameterList</m> has to be a tcl
list consisting of parameter name and value pairs.</p>

<p>If the option <m>-ignoreUndeclaredParameters</m> is given, then parameter
names in the <m>parameterList</m> given to the <m>-parameters</m> options that
are not declared as top-level parameters in the stylesheet are silently
ignored. Without this option, an error is raised if the user tries to set a
top-level parameter which is not declared in the stylesheet.</p>

<p>The option <m>-maxApplyDepth</m> expects a positive integer as
argument. By default, the xslt engine allows xslt templates to nest up
to 3000 levels (and raises error if they nest deeper). This limit can
be set by the <m>-maxApplyDepth</m> option.</p>

<p>The <m>-xsltmessagecmd</m> option sets a callback for xslt:message elements
in the stylesheet. The actual command consists of the script, given as argument
to the option, appended with the XML Fragment from instantiating the
xsl:message element content as string (as if the XPath string() function would
have been applied to the XML Fragment) and a flag, which indicates wether the
xsl:message has an attribute "terminate" with the value "yes". If the
called script returns anything else then TCL_OK then the xslt
transformation will be aborted, returning error. If the called script
returns -code break the error message is empty, otherwise the result
code is reported. In case of terminated transformation the outputVar,
if given, is set to the empty string.</p>
</desc>
      </commanddef>

      <commanddef>
        <command><m>@attrName</m></command>
        <desc>Returns the value of the attribute <m>attrName</m>.  Short cut

Changes to doc/expat.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
..
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
...
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
...
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
<html>
<head>
<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 $">
</head><body>
<div class="header">
<div class="navbar" align="center">
<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>
</div><hr class="navsep">
</div><div class="body">
    <h2><a name="SECTid0x139ef10">NAME</a></h2><p class="namesection">
<b class="names">expat - </b><br>Creates an instance of an expat parser object</p>



    <h2><a name="SECTid0x13a60f0">SYNOPSIS</a></h2><pre class="syntax">package require tdom

<b class="cmd">expat</b> ?<i class="m">parsername</i>? ?<i class="m">-namespace</i>? ?<i class="m">arg arg ..</i>

<b class="cmd">xml::parser</b> ?<i class="m">parsername</i>? ?<i class="m">-namespace</i>? ?<i class="m">arg arg ..</i>
</pre>
    <h2><a name="SECTid0x137dce0">DESCRIPTION</a></h2><p>The parser created with <i class="m">expat</i> or <i class="m">xml::parser</i>
(which is just another name for the same command in an own namespace) are able
to parse any kind of well-formed XML. The parsers are stream oriented XML
parser. This means that you register handler scripts with the parser prior to
starting the parse. These handler scripts are called when the parser discovers
the associated structures in the document being parsed.  A start tag is an
example of the kind of structures for which you may register a handler
script.</p><p>The parsers do not validate the XML document. They do parse the internal DTD
................................................................................
there).</p><p>Additionly, the Tcl extension code that implements this command provides an
API for adding C level coded handlers. Up to now, there exists the parser
extension command "tdom". The handler set installed by this extension build an
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
and C level handlers for most of the events. If the event occurs, they are
called in turn.</p>

    <h2><a name="SECTid0x137ea20">COMMAND OPTIONS</a></h2><dl class="optlist">
        
          <dt><b>-namespace</b></dt>

          <dd>
<p>Enables namespace parsing. You must use this option while
creating the parser with the <tt class="samp">expat</tt> or <tt class="samp">xml::parser</tt>
command. You can't enable (nor disable) namespace parsing with
................................................................................
-paramentityparsing value of "never" (which is the default) suppresses any call
to the -externalentitycommand script. Pleace notice, that, if the document also
doesn't have an internal subset, the -startdoctypedeclcommand and
enddoctypedeclcommand scripts, if set, are not called.</dd>
        

      </dl>
    <h2><a name="SECTid0x13b9910"> COMMAND METHODS </a></h2><dl class="commandlist">
        
          <dt>
<b class="cmd">parser</b> <b class="method">configure</b> <i class="m">option value ?option value?</i>
</dt>

          <dd><p>Sets configuration options for the parser. Every command
option, except <i class="m">-namespace</i> can be set or modified with this method.</p></dd>
................................................................................
          <dd><p>Resets the parser in preparation for parsing another
document. A parser cannot be reseted from within one of its handler callbacks
(neither directly nor indirectly) and will raise a tcl error in this
cases.</p></dd>
        
      </dl>

    <h2><a name="SECTid0x13bfd70">Callback Command Return Codes</a></h2><p>A script invoked for any of the parser callback commands, such as
-elementstartcommand, -elementendcommand, etc, may return an error code other
than "ok" or "error". All callbacks may in addition return
"break" or "continue".</p><p>If a callback script returns an "error" error code then
processing of the document is terminated and the error is propagated in the
usual fashion.</p><p>If a callback script returns a "break" error code then all
further processing of every handler script out of this Tcl handler set is
suppressed for the further parsing. This does not influence any other handler
set.</p><p>If a callback script returns a "continue" error code then
processing of the current element, and its children, ceases for every handler
script out of this Tcl handler set and processing continues with the next
(sibling) element. This does not influence any other handler set.</p><p>If a callback script returns a "return" error
code then parsing is canceled altogether, but no error is raised.</p>

    <h2><a name="SECTid0x13c0900">SEE ALSO</a></h2><p class="seealso">
<a href="expatapi.html">expatapi</a>, <a href="tdomcmd.html">tdom</a>
</p>

    <h2><a name="SECTid0x13c0cc0">KEYWORDS</a></h2><p class="keywords"><a class="keyword" href="keyword-index.html#KW-SAX">SAX</a></p>
  </div><hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</body>
</html>


|



|


|




|





|







 







|







 







|







 







|













|



|

|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
..
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
...
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
...
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
<html>
<head>
<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">
</head><body>
<div class="header">
<div class="navbar" align="center">
<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>
</div><hr class="navsep">
</div><div class="body">
    <h2><a name="SECTid0x1f2bd90">NAME</a></h2><p class="namesection">
<b class="names">expat - </b><br>Creates an instance of an expat parser object</p>



    <h2><a name="SECTid0x1e4da40">SYNOPSIS</a></h2><pre class="syntax">package require tdom

<b class="cmd">expat</b> ?<i class="m">parsername</i>? ?<i class="m">-namespace</i>? ?<i class="m">arg arg ..</i>

<b class="cmd">xml::parser</b> ?<i class="m">parsername</i>? ?<i class="m">-namespace</i>? ?<i class="m">arg arg ..</i>
</pre>
    <h2><a name="SECTid0x1f36860">DESCRIPTION</a></h2><p>The parser created with <i class="m">expat</i> or <i class="m">xml::parser</i>
(which is just another name for the same command in an own namespace) are able
to parse any kind of well-formed XML. The parsers are stream oriented XML
parser. This means that you register handler scripts with the parser prior to
starting the parse. These handler scripts are called when the parser discovers
the associated structures in the document being parsed.  A start tag is an
example of the kind of structures for which you may register a handler
script.</p><p>The parsers do not validate the XML document. They do parse the internal DTD
................................................................................
there).</p><p>Additionly, the Tcl extension code that implements this command provides an
API for adding C level coded handlers. Up to now, there exists the parser
extension command "tdom". The handler set installed by this extension build an
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
and C level handlers for most of the events. If the event occurs, they are
called in turn.</p>

    <h2><a name="SECTid0x1f375a0">COMMAND OPTIONS</a></h2><dl class="optlist">
        
          <dt><b>-namespace</b></dt>

          <dd>
<p>Enables namespace parsing. You must use this option while
creating the parser with the <tt class="samp">expat</tt> or <tt class="samp">xml::parser</tt>
command. You can't enable (nor disable) namespace parsing with
................................................................................
-paramentityparsing value of "never" (which is the default) suppresses any call
to the -externalentitycommand script. Pleace notice, that, if the document also
doesn't have an internal subset, the -startdoctypedeclcommand and
enddoctypedeclcommand scripts, if set, are not called.</dd>
        

      </dl>
    <h2><a name="SECTid0x1f75430"> COMMAND METHODS </a></h2><dl class="commandlist">
        
          <dt>
<b class="cmd">parser</b> <b class="method">configure</b> <i class="m">option value ?option value?</i>
</dt>

          <dd><p>Sets configuration options for the parser. Every command
option, except <i class="m">-namespace</i> can be set or modified with this method.</p></dd>
................................................................................
          <dd><p>Resets the parser in preparation for parsing another
document. A parser cannot be reseted from within one of its handler callbacks
(neither directly nor indirectly) and will raise a tcl error in this
cases.</p></dd>
        
      </dl>

    <h2><a name="SECTid0x1f7f8a0">Callback Command Return Codes</a></h2><p>A script invoked for any of the parser callback commands, such as
-elementstartcommand, -elementendcommand, etc, may return an error code other
than "ok" or "error". All callbacks may in addition return
"break" or "continue".</p><p>If a callback script returns an "error" error code then
processing of the document is terminated and the error is propagated in the
usual fashion.</p><p>If a callback script returns a "break" error code then all
further processing of every handler script out of this Tcl handler set is
suppressed for the further parsing. This does not influence any other handler
set.</p><p>If a callback script returns a "continue" error code then
processing of the current element, and its children, ceases for every handler
script out of this Tcl handler set and processing continues with the next
(sibling) element. This does not influence any other handler set.</p><p>If a callback script returns a "return" error
code then parsing is canceled altogether, but no error is raised.</p>

    <h2><a name="SECTid0x1f80430">SEE ALSO</a></h2><p class="seealso">
<a href="expatapi.html">expatapi</a>, <a href="tdomcmd.html">tdom</a>
</p>

    <h2><a name="SECTid0x1f807f0">KEYWORDS</a></h2><p class="keywords"><a class="keyword" href="keyword-index.html#KW-SAX">SAX</a></p>
  </div><hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</body>
</html>

Changes to doc/expatapi.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
..
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
...
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<html>
<head>
<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 $">
</head><body>
<div class="header">
<div class="navbar" align="center">
<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>
</div><hr class="navsep">
</div><div class="body">
    <h2><a name="SECTid0x139c8b0">NAME</a></h2><p class="namesection">
<b class="names">CheckExpatParserObj, CHandlerSetInstall, CHandlerSetRemove,
         CHandlerSetCreate, CHandlerSetGetUserData, GetExpatInfo - </b><br>Functions to create, install and remove expat parser object
extensions.</p>
  <h2><a name="SECTid0x13eb870">SYNOPSIS</a></h2><pre class="syntax">#include &lt;tclexpat.h&gt;

int 
<b class="fun">CheckExpatParserObj</b> (<a href="#ARG-interp"><i>interp</i></a>, <a href="#ARG-nameObj"><i>nameObj</i></a>)  

int
<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>)

................................................................................
void*
<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>)

TclGenExpatInfo*
<b class="fun">GetExpatInfo</b> (<a href="#ARG-interp"><i>interp</i></a>, <a href="#ARG-expatObj"><i>expatObj</i></a>)
</pre>

  <h2><a name="SECTid0x137b620">ARGUMENTS</a></h2><div class="arglist"><table width="100%" rules="none" cellpadding="5%">
<thead><tr class="heading">
<th width="20%">Type</th><th width="70%">Name</th><th width="10%">Mode</th>
</tr></thead><tr class="syntax">
<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>
</tr><tr class="desc">
<td class="padding" width="20%"> </td><td class="argdesc" width="80%" align="left" colspan="2">Interpreter with the expat parser object.</td>
</tr><tr class="syntax">
................................................................................
</tr><tr class="syntax">
<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>
</tr><tr class="desc">
<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>
</tr>
</table></div>

  <h2><a name="SECTid0x137d6e0">DESCRIPTION</a></h2><p>The functions described in this manual allows to add C level coded event
handler to an tDOM Tcl expat parser objects. A tDOM Tcl expat parser object is
able to have several Tcl scripts and C functions associated with an specific
event. If the event occurs, first the Tcl scripts then the C functions
associated with the event are called in turn.</p><p>A tDOM Tcl expat parser extension is an ordinary Tcl extension and loaded
like every other Tcl extension. It must install at least one new Tcl Level
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">
typedef struct CHandlerSet {
................................................................................
TclGenExpatInfo structure of the tDOM Tcl expat parser object
<i class="m">expatObj</i>. The <i class="m">expatObj</i> has to be a tDOM Tcl expat parser object
in the interpreter <i class="m">interp</i>. This is most useful, to set the application
status of the parser object.</p><p>See the simple but full functionally example in the extensions/example
dir or the more complex example tnc in the extensions/tnc dir (a simple DTD
validation extension).</p>

  <h2><a name="SECTid0x13b1f40">SEE ALSO</a></h2><p class="seealso">expat</p>

  <h2><a name="SECTid0x13b21e0">KEYWORDS</a></h2><p class="keywords"><a class="keyword" href="keyword-index.html#KW-Chandlerset">C handler set</a></p>
</div><hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</body>
</html>


|



|


|



|







 







|







 







|







 







|

|

|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
..
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
...
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<html>
<head>
<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">
</head><body>
<div class="header">
<div class="navbar" align="center">
<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>
</div><hr class="navsep">
</div><div class="body">
    <h2><a name="SECTid0x1fa3230">NAME</a></h2><p class="namesection">
<b class="names">CheckExpatParserObj, CHandlerSetInstall, CHandlerSetRemove,
         CHandlerSetCreate, CHandlerSetGetUserData, GetExpatInfo - </b><br>Functions to create, install and remove expat parser object
extensions.</p>
  <h2><a name="SECTid0x1f5add0">SYNOPSIS</a></h2><pre class="syntax">#include &lt;tclexpat.h&gt;

int 
<b class="fun">CheckExpatParserObj</b> (<a href="#ARG-interp"><i>interp</i></a>, <a href="#ARG-nameObj"><i>nameObj</i></a>)  

int
<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>)

................................................................................
void*
<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>)

TclGenExpatInfo*
<b class="fun">GetExpatInfo</b> (<a href="#ARG-interp"><i>interp</i></a>, <a href="#ARG-expatObj"><i>expatObj</i></a>)
</pre>

  <h2><a name="SECTid0x1f1ee50">ARGUMENTS</a></h2><div class="arglist"><table width="100%" rules="none" cellpadding="5%">
<thead><tr class="heading">
<th width="20%">Type</th><th width="70%">Name</th><th width="10%">Mode</th>
</tr></thead><tr class="syntax">
<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>
</tr><tr class="desc">
<td class="padding" width="20%"> </td><td class="argdesc" width="80%" align="left" colspan="2">Interpreter with the expat parser object.</td>
</tr><tr class="syntax">
................................................................................
</tr><tr class="syntax">
<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>
</tr><tr class="desc">
<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>
</tr>
</table></div>

  <h2><a name="SECTid0x1f20f10">DESCRIPTION</a></h2><p>The functions described in this manual allows to add C level coded event
handler to an tDOM Tcl expat parser objects. A tDOM Tcl expat parser object is
able to have several Tcl scripts and C functions associated with an specific
event. If the event occurs, first the Tcl scripts then the C functions
associated with the event are called in turn.</p><p>A tDOM Tcl expat parser extension is an ordinary Tcl extension and loaded
like every other Tcl extension. It must install at least one new Tcl Level
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">
typedef struct CHandlerSet {
................................................................................
TclGenExpatInfo structure of the tDOM Tcl expat parser object
<i class="m">expatObj</i>. The <i class="m">expatObj</i> has to be a tDOM Tcl expat parser object
in the interpreter <i class="m">interp</i>. This is most useful, to set the application
status of the parser object.</p><p>See the simple but full functionally example in the extensions/example
dir or the more complex example tnc in the extensions/tnc dir (a simple DTD
validation extension).</p>

  <h2><a name="SECTid0x1f2e6c0">SEE ALSO</a></h2><p class="seealso">expat</p>

  <h2><a name="SECTid0x1f2e960">KEYWORDS</a></h2><p class="keywords"><a class="keyword" href="keyword-index.html#KW-Chandlerset">C handler set</a></p>
</div><hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</body>
</html>

Changes to doc/index.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<html>
<head>
<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 $">
</head><body>
<div class="header">
<h1 class="title" align="center">tDOM manual: Contents</h1><p class="navaid" align="center">
<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>
</p><hr class="navsep">
</div><div class="body"><ul class="toc">
<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
extensions.</a></li><li class="tocentry"><a href="tdomcmd.html">tdom - tdom is an expat parser object extension to create an in-memory
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
stream against the document DTD while parsing.</a></li>
</ul></div><div class="footer">
<hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</div>
</body>
</html>


|



|








|




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<html>
<head>
<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">
</head><body>
<div class="header">
<h1 class="title" align="center">tDOM manual: Contents</h1><p class="navaid" align="center">
<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>
</p><hr class="navsep">
</div><div class="body"><ul class="toc">
<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
extensions.</a></li><li class="tocentry"><a href="tdomcmd.html">tdom - tdom is an expat parser object extension to create an in-memory
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
stream against the document DTD while parsing.</a></li>
</ul></div><div class="footer">
<hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</div>
</body>
</html>

Changes to doc/keyword-index.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<html>
<head>
<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 $">
</head><body>
<div class="header">
<h1 class="title" align="center">tDOM manual: Keywords</h1><p class="navaid" align="center">
<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>
</p><hr class="navsep"><div class="navbar">
<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>
</div><div class="body"><div class="table"><table width="100%">
<tr class="header"><th colspan="2"><a name="KEYWORDS-C">Keywords: C</a></th></tr><tr class="row1">
<td width="35%"><a name="KW-Chandlerset">C handler set</a></td><td width="65%">
<a href="expatapi.html">expatapi</a> · <a href="tdomcmd.html">tdom</a>
</td>
</tr><tr class="row0">
<td width="35%"><a name="KW-CheckExpatParserObj,CHandlerSetInstall,CHandlerSetRemove,CHandlerSetCreate,CHandlerSetGetUserData,GetExpatInfo">CheckExpatParserObj, CHandlerSetInstall, CHandlerSetRemove,
         CHandlerSetCreate, CHandlerSetGetUserData, GetExpatInfo</a></td><td width="65%"><a href="expatapi.html">expatapi</a></td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-D">Keywords: D</a></th></tr><tr class="row1">
<td width="35%"><a name="KW-document">document</a></td><td width="65%">
<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a>
</td>
</tr><tr class="row0">
<td width="35%"><a name="KW-documentelement">document element</a></td><td width="65%"><a href="domDoc.html">domDoc</a></td>
</tr><tr class="row1">
<td width="35%"><a name="KW-dom">dom</a></td><td width="65%">
<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a> · <a href="tdomcmd.html">tdom</a>
</td>
</tr><tr class="row0">
<td width="35%"><a name="KW-DOMnodecreation">DOM node creation</a></td><td width="65%"><a href="domDoc.html">domDoc</a></td>
</tr><tr class="row1">
<td width="35%"><a name="KW-domDoc">domDoc</a></td><td width="65%"><a href="domDoc.html">domDoc</a></td>
</tr><tr class="row0">
<td width="35%"><a name="KW-domNode">domNode</a></td><td width="65%"><a href="domNode.html">domNode</a></td>
................................................................................
<td width="35%"><a name="KW-DTD">DTD</a></td><td width="65%"><a href="tnc.html">tnc</a></td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-E">Keywords: E</a></th></tr><tr class="row0">
<td width="35%"><a name="KW-expat">expat</a></td><td width="65%"><a href="expat.html">expat</a></td>
</tr><tr class="row1">
<td width="35%"><a name="KW-expatapi">expatapi</a></td><td width="65%"><a href="expatapi.html">expatapi</a></td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-N">Keywords: N</a></th></tr><tr class="row0">
<td width="35%"><a name="KW-node">node</a></td><td width="65%">
<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a>
</td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-P">Keywords: P</a></th></tr><tr class="row1">
<td width="35%"><a name="KW-parsing">parsing</a></td><td width="65%">
<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a>
</td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-S">Keywords: S</a></th></tr><tr class="row0">
<td width="35%"><a name="KW-SAX">SAX</a></td><td width="65%">
<a href="expat.html">expat</a> · <a href="tdomcmd.html">tdom</a>
</td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-T">Keywords: T</a></th></tr><tr class="row1">
<td width="35%"><a name="KW-tdom">tdom</a></td><td width="65%"><a href="tdomcmd.html">tdom</a></td>
</tr><tr class="row0">
<td width="35%"><a name="KW-tdomcmd">tdomcmd</a></td><td width="65%"><a href="tdomcmd.html">tdom</a></td>
</tr><tr class="row1">
<td width="35%"><a name="KW-tnc">tnc</a></td><td width="65%"><a href="tnc.html">tnc</a></td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-V">Keywords: V</a></th></tr><tr class="row0">
<td width="35%"><a name="KW-Validation">Validation</a></td><td width="65%"><a href="tnc.html">tnc</a></td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-X">Keywords: X</a></th></tr><tr class="row1">
<td width="35%"><a name="KW-XML">XML</a></td><td width="65%">
<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a>
</td>
</tr><tr class="row0">
<td width="35%"><a name="KW-xml::parser">xml::parser</a></td><td width="65%"><a href="expat.html">expat</a></td>
</tr>
</table></div></div><div class="footer">
<hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</div>
</body>
</html>


|



|

|



|






|





|







 







|



|



|











|






|




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<html>
<head>
<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">
</head><body>
<div class="header">
<h1 class="title" align="center">tDOM manual: Keywords</h1><p class="navaid" align="center">
<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>
</p><hr class="navsep"><div class="navbar">
<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>
</div><div class="body"><div class="table"><table width="100%">
<tr class="header"><th colspan="2"><a name="KEYWORDS-C">Keywords: C</a></th></tr><tr class="row1">
<td width="35%"><a name="KW-Chandlerset">C handler set</a></td><td width="65%">
<a href="expatapi.html">expatapi</a> · <a href="tdomcmd.html">tdom</a>
</td>
</tr><tr class="row0">
<td width="35%"><a name="KW-CheckExpatParserObj,CHandlerSetInstall,CHandlerSetRemove,CHandlerSetCreate,CHandlerSetGetUserData,GetExpatInfo">CheckExpatParserObj, CHandlerSetInstall, CHandlerSetRemove,
         CHandlerSetCreate, CHandlerSetGetUserData, GetExpatInfo</a></td><td width="65%"><a href="expatapi.html">expatapi</a></td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-D">Keywords: D</a></th></tr><tr class="row1">
<td width="35%"><a name="KW-document">document</a></td><td width="65%">
<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a>
</td>
</tr><tr class="row0">
<td width="35%"><a name="KW-documentelement">document element</a></td><td width="65%"><a href="domDoc.html">domDoc</a></td>
</tr><tr class="row1">
<td width="35%"><a name="KW-dom">dom</a></td><td width="65%">
<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a> · <a href="tdomcmd.html">tdom</a>
</td>
</tr><tr class="row0">
<td width="35%"><a name="KW-DOMnodecreation">DOM node creation</a></td><td width="65%"><a href="domDoc.html">domDoc</a></td>
</tr><tr class="row1">
<td width="35%"><a name="KW-domDoc">domDoc</a></td><td width="65%"><a href="domDoc.html">domDoc</a></td>
</tr><tr class="row0">
<td width="35%"><a name="KW-domNode">domNode</a></td><td width="65%"><a href="domNode.html">domNode</a></td>
................................................................................
<td width="35%"><a name="KW-DTD">DTD</a></td><td width="65%"><a href="tnc.html">tnc</a></td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-E">Keywords: E</a></th></tr><tr class="row0">
<td width="35%"><a name="KW-expat">expat</a></td><td width="65%"><a href="expat.html">expat</a></td>
</tr><tr class="row1">
<td width="35%"><a name="KW-expatapi">expatapi</a></td><td width="65%"><a href="expatapi.html">expatapi</a></td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-N">Keywords: N</a></th></tr><tr class="row0">
<td width="35%"><a name="KW-node">node</a></td><td width="65%">
<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a>
</td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-P">Keywords: P</a></th></tr><tr class="row1">
<td width="35%"><a name="KW-parsing">parsing</a></td><td width="65%">
<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a>
</td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-S">Keywords: S</a></th></tr><tr class="row0">
<td width="35%"><a name="KW-SAX">SAX</a></td><td width="65%">
<a href="expat.html">expat</a> · <a href="tdomcmd.html">tdom</a>
</td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-T">Keywords: T</a></th></tr><tr class="row1">
<td width="35%"><a name="KW-tdom">tdom</a></td><td width="65%"><a href="tdomcmd.html">tdom</a></td>
</tr><tr class="row0">
<td width="35%"><a name="KW-tdomcmd">tdomcmd</a></td><td width="65%"><a href="tdomcmd.html">tdom</a></td>
</tr><tr class="row1">
<td width="35%"><a name="KW-tnc">tnc</a></td><td width="65%"><a href="tnc.html">tnc</a></td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-V">Keywords: V</a></th></tr><tr class="row0">
<td width="35%"><a name="KW-Validation">Validation</a></td><td width="65%"><a href="tnc.html">tnc</a></td>
</tr><tr class="header"><th colspan="2"><a name="KEYWORDS-X">Keywords: X</a></th></tr><tr class="row1">
<td width="35%"><a name="KW-XML">XML</a></td><td width="65%">
<a href="dom.html">dom</a> · <a href="domNode.html">domNode</a>
</td>
</tr><tr class="row0">
<td width="35%"><a name="KW-xml::parser">xml::parser</a></td><td width="65%"><a href="expat.html">expat</a></td>
</tr>
</table></div></div><div class="footer">
<hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</div>
</body>
</html>

Changes to doc/tdomcmd.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
..
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<html>
<head>
<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 $">
</head><body>
<div class="header">
<div class="navbar" align="center">
<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>
</div><hr class="navsep">
</div><div class="body">
    <h2><a name="SECTid0x1402f70">NAME</a></h2><p class="namesection">
<b class="names">tdom - </b><br>tdom is an expat parser object extension to create an in-memory
DOM tree from the input while parsing.</p>


  <h2><a name="SECTid0x12a9d60">SYNOPSIS</a></h2><pre class="syntax">package require tdom

set parser [expat]

tdom $parser enable</pre>

  <h2><a name="SECTid0x12d0010">DESCRIPTION</a></h2><p>
<i class="m">tdom</i> adds the C handler set "tdom" to an tcl expat
parser obj. This handler set builds an in-memory DOM tree out of the input,
parsed by the parser. A DOM tree created this way behave exactly like a DOM
tree created by the "dom" command (see there). In fact, tdom is only
another interface to the same functionality; it uses the code behind the
<tt class="samp">dom</tt> code for building the DOM tree.</p><dl class="commandlist">
      
................................................................................
<b class="cmd">tdom</b> <i class="m">parserObj</i> <b class="method">setExternalEntityResolver</b> <i class="m">script</i>
</dt>
        <dd></dd>
      

    </dl>

  <h2><a name="SECTid0x13bd260">SEE ALSO</a></h2><p class="seealso">dom, expat</p>

  <h2><a name="SECTid0x13bd5c0">KEYWORDS</a></h2><p class="keywords">
<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>
</p>

</div><hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</body>
</html>


|



|


|




|





|







 







|

|




|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
..
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<html>
<head>
<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">
</head><body>
<div class="header">
<div class="navbar" align="center">
<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>
</div><hr class="navsep">
</div><div class="body">
    <h2><a name="SECTid0x1e30200">NAME</a></h2><p class="namesection">
<b class="names">tdom - </b><br>tdom is an expat parser object extension to create an in-memory
DOM tree from the input while parsing.</p>


  <h2><a name="SECTid0x1f5add0">SYNOPSIS</a></h2><pre class="syntax">package require tdom

set parser [expat]

tdom $parser enable</pre>

  <h2><a name="SECTid0x1e4db90">DESCRIPTION</a></h2><p>
<i class="m">tdom</i> adds the C handler set "tdom" to an tcl expat
parser obj. This handler set builds an in-memory DOM tree out of the input,
parsed by the parser. A DOM tree created this way behave exactly like a DOM
tree created by the "dom" command (see there). In fact, tdom is only
another interface to the same functionality; it uses the code behind the
<tt class="samp">dom</tt> code for building the DOM tree.</p><dl class="commandlist">
      
................................................................................
<b class="cmd">tdom</b> <i class="m">parserObj</i> <b class="method">setExternalEntityResolver</b> <i class="m">script</i>
</dt>
        <dd></dd>
      

    </dl>

  <h2><a name="SECTid0x1f20b70">SEE ALSO</a></h2><p class="seealso">dom, expat</p>

  <h2><a name="SECTid0x1f20f00">KEYWORDS</a></h2><p class="keywords">
<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>
</p>

</div><hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</body>
</html>

Changes to doc/tnc.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<html>
<head>
<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 $">
</head><body>
<div class="header">
<div class="navbar" align="center">
<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>
</div><hr class="navsep">
</div><div class="body">
  <h2><a name="SECTid0x1409a40">NAME</a></h2><p class="namesection">
<b class="names">tnc - </b><br>tnc is an expat parser object extension, that validates the XML
stream against the document DTD while parsing.</p>
  
  <h2><a name="SECTid0x132e810">SYNOPSIS</a></h2><pre class="syntax">package require tdom
package require tnc

set parser [expat]

tnc $parser enable</pre>

  <h2><a name="SECTid0x132e670">DESCRIPTION</a></h2><p>
<i class="m">tnc</i> adds the C handler set "tnc" to a tcl expat parser
obj. This handler set is a simple DTD validator. If the validator detects a
validation error, it sets the interp result, signals error and stops
parsing. There isn't any validation error recovering. As a consequence, only
valid documents are completely parsed.</p><p>This handler set has only three methods:</p><dl class="commandlist">
      
        <dt>
................................................................................
      

      </dl>
     </dd>
      
    </dl>

  <h2><a name="SECTid0x13bdd50">BUGS</a></h2><p>The validation error reports could be much more informative and
user-friendly.</p><p>The validator doesn't detect ambiguous content models (see XML
recomendation Section 3.2.1 and Appendix E). Most Java validators also doesn't,
but handle such content models right anyhow. Tnc does not; if your DTD has
such ambiguous content models, tnc can not used to validate documents against
such (not completely XML spec compliant) DTDs.</p><p>It isn't possible to validate XML documents with standalone="yes" in the
XML Declaration</p><p>Violations of the validity constraints Proper Group/PE Nesting and
Proper Conditional Section/PE Nesting are not detected. They could only happen
inside a invalid DTD, not in the content of a document.</p>
  <h2><a name="SECTid0x13be6c0">KEYWORDS</a></h2><p class="keywords">
<a class="keyword" href="keyword-index.html#KW-Validation">Validation</a>, <a class="keyword" href="keyword-index.html#KW-DTD">DTD</a>
</p>
  
</div><hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</body>
</html>


|



|


|



|






|







 







|








|




|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<html>
<head>
<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">
</head><body>
<div class="header">
<div class="navbar" align="center">
<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>
</div><hr class="navsep">
</div><div class="body">
  <h2><a name="SECTid0x1f21840">NAME</a></h2><p class="namesection">
<b class="names">tnc - </b><br>tnc is an expat parser object extension, that validates the XML
stream against the document DTD while parsing.</p>
  
  <h2><a name="SECTid0x1e300b0">SYNOPSIS</a></h2><pre class="syntax">package require tdom
package require tnc

set parser [expat]

tnc $parser enable</pre>

  <h2><a name="SECTid0x1f31680">DESCRIPTION</a></h2><p>
<i class="m">tnc</i> adds the C handler set "tnc" to a tcl expat parser
obj. This handler set is a simple DTD validator. If the validator detects a
validation error, it sets the interp result, signals error and stops
parsing. There isn't any validation error recovering. As a consequence, only
valid documents are completely parsed.</p><p>This handler set has only three methods:</p><dl class="commandlist">
      
        <dt>
................................................................................
      

      </dl>
     </dd>
      
    </dl>

  <h2><a name="SECTid0x1f677e0">BUGS</a></h2><p>The validation error reports could be much more informative and
user-friendly.</p><p>The validator doesn't detect ambiguous content models (see XML
recomendation Section 3.2.1 and Appendix E). Most Java validators also doesn't,
but handle such content models right anyhow. Tnc does not; if your DTD has
such ambiguous content models, tnc can not used to validate documents against
such (not completely XML spec compliant) DTDs.</p><p>It isn't possible to validate XML documents with standalone="yes" in the
XML Declaration</p><p>Violations of the validity constraints Proper Group/PE Nesting and
Proper Conditional Section/PE Nesting are not detected. They could only happen
inside a invalid DTD, not in the content of a document.</p>
  <h2><a name="SECTid0x1f2af70">KEYWORDS</a></h2><p class="keywords">
<a class="keyword" href="keyword-index.html#KW-Validation">Validation</a>, <a class="keyword" href="keyword-index.html#KW-DTD">DTD</a>
</p>
  
</div><hr class="navsep"><div class="navbar" align="center">
<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>
</div>
</body>
</html>

Changes to expat/winconfig.h.

20
21
22
23
24
25
26
27
28
29
30
#define XML_NS 1
#define XML_DTD 1
#define XML_CONTEXT_BYTES 1024

/* we will assume all Windows platforms are little endian */
#define BYTEORDER 1234

/* Windows has memmove() available. */
#define HAVE_MEMMOVE

#endif /* ndef WINCONFIG_H */







<
<
<

20
21
22
23
24
25
26



27
#define XML_NS 1
#define XML_DTD 1
#define XML_CONTEXT_BYTES 1024

/* we will assume all Windows platforms are little endian */
#define BYTEORDER 1234




#endif /* ndef WINCONFIG_H */

Changes to extensions/example/configure.

638
639
640
641
642
643
644

645
646
647
648
649
650
651
652
653
654
655
656
657






658
659
660
661
662
663
664
...
731
732
733
734
735
736
737

738
739
740
741
742
743
744
....
1358
1359
1360
1361
1362
1363
1364


1365
1366
1367
1368
1369
1370
1371
....
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
....
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
....
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
....
2427
2428
2429
2430
2431
2432
2433

2434
2435
2436
2437


2438
2439
2440
2441
2442
2443
2444
....
3350
3351
3352
3353
3354
3355
3356

3357


3358

3359






































3360
3361
3362
3363
3364
3365
3366
....
4107
4108
4109
4110
4111
4112
4113














4114
4115
4116
4117
4118
4119
4120
....
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
















5958
5959
5960
5961

5962
5963
5964
5965
5966
5967
5968




5969
















5970
5971
5972
5973
5974
5975
5976
....
6138
6139
6140
6141
6142
6143
6144



6145
6146
6147
6148
6149
6150
6151
....
6332
6333
6334
6335
6336
6337
6338
6339


6340
6341
6342
6343
6344
6345
6346
....
6496
6497
6498
6499
6500
6501
6502


















6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
....
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
....
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
....
6882
6883
6884
6885
6886
6887
6888

6889
6890

6891
6892
6893
6894
6895
6896
6897
....
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206


7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
....
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307


7308
7309
7310
7311
7312


7313
7314
7315
7316
7317
7318
7319
....
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
....
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
....
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
....
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
....
8079
8080
8081
8082
8083
8084
8085

8086
8087
8088
8089
8090
8091
8092
....
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
....
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
....
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
....
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608




8609
8610
8611


8612

8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
....
8660
8661
8662
8663
8664
8665
8666

8667







8668
8669
8670
8671
8672
8673
8674
STLIB_LD
CFLAGS_WARNING
CFLAGS_OPTIMIZE
CFLAGS_DEBUG
RC
CELIB_DIR
AR

SHARED_BUILD
TCL_THREADS
TCL_INCLUDES
PKG_OBJECTS
PKG_SOURCES
TDOM_SRC_DIR
TDOM_STUB_LIB_SPEC
TDOM_VERSION
MATH_LIBS
EGREP
GREP
RANLIB
SET_MAKE






CPP
TCL_SHLIB_LD_LIBS
TCL_LD_FLAGS
TCL_EXTRA_CFLAGS
TCL_DEFS
TCL_LIBS
CLEANFILES
................................................................................
ac_user_opts='
enable_option_checking
with_tcl
with_tdom
with_tclinclude
enable_threads
enable_shared

enable_64bit
enable_64bit_vis
enable_rpath
enable_wince
with_celib
enable_symbols
'
................................................................................

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-threads        build with threads
  --enable-shared         build and link with shared libraries (default: on)


  --enable-64bit          enable 64bit support (default: off)
  --enable-64bit-vis      enable 64bit Sparc VIS support (default: off)
  --disable-rpath         disable rpath support (default: on)
  --enable-wince          enable Win/CE support (where applicable)
  --enable-symbols        build with debugging symbols (default: off)

Optional Packages:
................................................................................
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------


    # TEA extensions pass this us the version of TEA they think they
    # are compatible with.
    TEA_VERSION="3.9"

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct TEA configuration" >&5
$as_echo_n "checking for correct TEA configuration... " >&6; }
    if test x"${PACKAGE_NAME}" = x ; then
	as_fn_error $? "
The PACKAGE_NAME variable must be defined by your TEA configure.in" "$LINENO" 5
    fi
    if test x"3.9" = x ; then
	as_fn_error $? "
TEA version not specified." "$LINENO" 5
    elif test "3.9" != "${TEA_VERSION}" ; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&5
$as_echo "warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&6; }
    else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5
$as_echo "ok (TEA ${TEA_VERSION})" >&6; }
    fi

    # If the user did not set CFLAGS, set it now to keep macros
    # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2".
................................................................................
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    for ac_exec_ext in '' $ac_executable_extensions; do
  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CYGPATH="cygpath -w"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

................................................................................
fi


	    EXEEXT=".exe"
	    TEA_PLATFORM="windows"
	    ;;
	*CYGWIN_*)
	    CYGPATH=echo
	    EXEEXT=".exe"
	    # TEA_PLATFORM is determined later in LOAD_TCLCONFIG
	    ;;
	*)
	    CYGPATH=echo
	    # Maybe we are cross-compiling....
	    case ${host_alias} in
		*mingw32*)
		EXEEXT=".exe"
................................................................................
	    fi

	    # check in a few common install locations
	    if test x"${ac_cv_c_tclconfig}" = x ; then
		for i in `ls -d ${libdir} 2>/dev/null` \
			`ls -d ${exec_prefix}/lib 2>/dev/null` \
			`ls -d ${prefix}/lib 2>/dev/null` \

			`ls -d /usr/local/lib 2>/dev/null` \
			`ls -d /usr/contrib/lib 2>/dev/null` \
			`ls -d /usr/lib 2>/dev/null` \
			`ls -d /usr/lib64 2>/dev/null` \


			; do
		    if test -f "$i/tclConfig.sh" ; then
			ac_cv_c_tclconfig="`(cd $i; pwd)`"
			break
		    fi
		done
	    fi
................................................................................
	    #endif

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :

  TEA_PLATFORM="unix"


else

  TEA_PLATFORM="windows"







































fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    CC=$hold_cc
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEA_PLATFORM" >&5
$as_echo "$TEA_PLATFORM" >&6; }

................................................................................
fi

ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
















    #--------------------------------------------------------------------
    # Checks to see if the make program sets the $MAKE variable.
    #--------------------------------------------------------------------

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
................................................................................
#--------------------------------------------------------------------


    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5
$as_echo_n "checking how to build libraries... " >&6; }
    # Check whether --enable-shared was given.
if test "${enable_shared+set}" = set; then :
  enableval=$enable_shared; tcl_ok=$enableval
else
  tcl_ok=yes
fi


    if test "${enable_shared+set}" = set; then
	enableval="$enable_shared"
	tcl_ok=$enableval
    else
	tcl_ok=yes
    fi

















    if test "$tcl_ok" = "yes" ; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: shared" >&5
$as_echo "shared" >&6; }
	SHARED_BUILD=1

    else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5
$as_echo "static" >&6; }
	SHARED_BUILD=0

$as_echo "#define STATIC_BUILD 1" >>confdefs.h





    fi



















#--------------------------------------------------------------------
# This macro figures out what flags to use with the compiler/linker
# when building shared/static debug/optimized objects.  This information
# can be taken from the tclConfig.sh file, but this figures it all out.
................................................................................
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_visibility_hidden" >&5
$as_echo "$tcl_cv_cc_visibility_hidden" >&6; }
    if test $tcl_cv_cc_visibility_hidden = yes; then :


$as_echo "#define MODULE_SCOPE extern __attribute__((__visibility__(\"hidden\")))" >>confdefs.h





fi

    # Step 0.d: Disable -rpath support?

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if rpath support is requested" >&5
$as_echo_n "checking if rpath support is requested... " >&6; }
................................................................................
else
  AR="$ac_cv_prog_AR"
fi

    STLIB_LD='${AR} cr'
    LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
    if test "x$SHLIB_VERSION" = x; then :
  SHLIB_VERSION="1.0"


fi
    case $system in
	# TEA specific:
	windows)
	    # This is a 2-stage check to make sure we have the 64-bit SDK
	    # We have to know where the SDK is installed.
	    # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
................................................................................

	    if test "$GCC" != "yes" ; then
	        if test "${SHARED_BUILD}" = "0" ; then
		    runtime=-MT
	        else
		    runtime=-MD
	        fi



















                if test "$do64bit" != "no" ; then
		    # All this magic is necessary for the Win64 SDK RC1 - hobbs
		    CC="\"${PATH64}/cl.exe\""
		    CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
		    RC="\"${MSSDK}/bin/rc.exe\""
		    lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
		    LINKBIN="\"${PATH64}/link.exe\""
		    CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
		    # Avoid 'unresolved external symbol __security_cookie'
		    # errors, c.f. http://support.microsoft.com/?id=894573

    vars="bufferoverflowU.lib"
................................................................................
cat >>confdefs.h <<_ACEOF
#define UNDER_CE $CEVERSION
_ACEOF

		    CFLAGS_DEBUG="-nologo -Zi -Od"
		    CFLAGS_OPTIMIZE="-nologo -Ox"
		    lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
		    lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
		    LINKBIN="\"${CEBINROOT}/link.exe\""

		else
		    RC="rc"
		    lflags="-nologo"
    		    LINKBIN="link"
		    CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
		fi
	    fi

	    if test "$GCC" = "yes"; then
		# mingw gcc mode
................................................................................
$as_echo_n "checking for cross-compile version of gcc... " >&6; }
if ${ac_cv_cross+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

			    #ifdef __WIN32__
				#error cross-compiler
			    #endif

int
main ()
{

................................................................................
	    LDFLAGS="$LDFLAGS -export-dynamic"
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
	    ;;
	CYGWIN_*)
	    SHLIB_CFLAGS=""
	    SHLIB_LD='${CC} -shared'

	    SHLIB_SUFFIX=".dll"
	    EXEEXT=".exe"

	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
	    ;;
	Haiku*)
	    LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
	    SHLIB_CFLAGS="-fPIC"
	    SHLIB_SUFFIX=".so"
................................................................................
		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
	    ;;
	OpenBSD-*)
	    arch=`arch -s`
	    case "$arch" in
	    m88k|vax)
		SHLIB_SUFFIX=""
		SHARED_LIB_SUFFIX=""
		;;
	    *)
		SHLIB_CFLAGS="-fPIC"


		SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
		SHLIB_SUFFIX=".so"
		if test $doRpath = yes; then :

		    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
		;;
	    esac
	    case "$arch" in
	    m88k|vax)
		CFLAGS_OPTIMIZE="-O1"
		;;
	    *)
		CFLAGS_OPTIMIZE="-O2"
		;;
	    esac
	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF" >&5
$as_echo_n "checking for ELF... " >&6; }
if ${tcl_cv_ld_elf+:} false; then :
  $as_echo_n "(cached) " >&6
else

		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#ifdef __ELF__
	yes
#endif

_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  $EGREP "yes" >/dev/null 2>&1; then :
  tcl_cv_ld_elf=yes
else
  tcl_cv_ld_elf=no
fi
rm -f conftest*

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_elf" >&5
$as_echo "$tcl_cv_ld_elf" >&6; }
	    if test $tcl_cv_ld_elf = yes; then :

		LDFLAGS=-Wl,-export-dynamic

else
  LDFLAGS=""
fi
	    if test "${TCL_THREADS}" = "1"; then :

		# On OpenBSD:	Compile with -pthread
		#		Don't link with -lpthread
		LIBS=`echo $LIBS | sed s/-lpthread//`
		CFLAGS="$CFLAGS -pthread"

................................................................................

fi
	    ;;
	FreeBSD-*)
	    # This configuration from FreeBSD Ports.
	    SHLIB_CFLAGS="-fPIC"
	    SHLIB_LD="${CC} -shared"
	    TCL_SHLIB_LD_EXTRAS="-Wl,-soname \$@"
	    SHLIB_SUFFIX=".so"
	    LDFLAGS=""
	    if test $doRpath = yes; then :

		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
fi
	    if test "${TCL_THREADS}" = "1"; then :

		# The -pthread needs to go in the LDFLAGS, not LIBS
		LIBS=`echo $LIBS | sed s/-pthread//`
		CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
		LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
fi


	    # Version numbers are dot-stripped by system policy.
	    TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
	    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1'
	    TCL_LIB_VERSIONS_OK=nodots


	    ;;
	Darwin-*)
	    CFLAGS_OPTIMIZE="-Os"
	    SHLIB_CFLAGS="-fno-common"
	    # To avoid discrepancies between what headers configure sees during
	    # preprocessing tests and compiling tests, move any -isysroot and
	    # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
................................................................................
	    if test "$GCC" = yes; then :

		SHLIB_CFLAGS="-fPIC -melf"
		LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"

else

	       SHLIB_CFLAGS="-Kpic -belf"
	       LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"

fi
	    SHLIB_LD="ld -G"
	    SHLIB_LD_LIBS=""
	    SHLIB_SUFFIX=".so"
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
................................................................................
fi

    if test "$tcl_cv_cc_visibility_hidden" != yes; then :


$as_echo "#define MODULE_SCOPE extern" >>confdefs.h


$as_echo "#define NO_VIZ /**/" >>confdefs.h


fi

    if test "$SHARED_LIB_SUFFIX" = ""; then :

    # TEA specific: use PACKAGE_VERSION instead of VERSION
    SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'
................................................................................
fi
    if test "$UNSHARED_LIB_SUFFIX" = ""; then :

    # TEA specific: use PACKAGE_VERSION instead of VERSION
    UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'
fi

    if test "${GCC}" = "yes" ; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SEH support in compiler" >&5
$as_echo_n "checking for SEH support in compiler... " >&6; }
if ${tcl_cv_seh+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  tcl_cv_seh=no
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

	    #define WIN32_LEAN_AND_MEAN
	    #include <windows.h>
	    #undef WIN32_LEAN_AND_MEAN

	    int main(int argc, char** argv) {
		int a, b = 0;
		__try {
		    a = 666 / b;
		}
		__except (EXCEPTION_EXECUTE_HANDLER) {
................................................................................
$as_echo_n "checking for winnt.h that ignores VOID define... " >&6; }
if ${tcl_cv_winnt_ignore_void+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

		#define VOID void
		#define WIN32_LEAN_AND_MEAN
		#include <windows.h>
		#undef WIN32_LEAN_AND_MEAN

int
main ()
{

		CHAR c;
		SHORT s;
................................................................................
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_winnt_ignore_void" >&5
$as_echo "$tcl_cv_winnt_ignore_void" >&6; }
	if test "$tcl_cv_winnt_ignore_void" = "yes" ; then

$as_echo "#define HAVE_WINNT_IGNORE_VOID 1" >>confdefs.h

	fi


	# See if the compiler supports casting to a union type.
	# This is used to stop gcc from printing a compiler
	# warning when initializing a union member.

	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5
$as_echo_n "checking for cast to union support... " >&6; }
................................................................................
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5
$as_echo "$tcl_cv_cast_to_union" >&6; }
	if test "$tcl_cv_cast_to_union" = "yes"; then

$as_echo "#define HAVE_CAST_TO_UNION 1" >>confdefs.h

	fi
    fi







................................................................................
if ${tcl_cv_struct_dirent64+:} false; then :
  $as_echo_n "(cached) " >&6
else

	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <sys/types.h>
#include <sys/dirent.h>
int
main ()
{
struct dirent64 p;
  ;
  return 0;
}
................................................................................

    CLEANFILES="$CLEANFILES *.manifest"


fi
rm -f conftest*

	MAKE_STUB_LIB="\${STLIB_LD} -out:\$@ \$(PKG_STUB_OBJECTS)"
    else
	MAKE_STATIC_LIB="\${STLIB_LD} \$@ \$(PKG_OBJECTS)"
	MAKE_SHARED_LIB="\${SHLIB_LD} -o \$@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
	MAKE_STUB_LIB="\${STLIB_LD} \$@ \$(PKG_STUB_OBJECTS)"
    fi

    if test "${SHARED_BUILD}" = "1" ; then
................................................................................
    # substituted. (@@@ Might not be necessary anymore)
    #--------------------------------------------------------------------

    if test "${TEA_PLATFORM}" = "windows" ; then
	if test "${SHARED_BUILD}" = "1" ; then
	    # We force the unresolved linking of symbols that are really in
	    # the private libraries of Tcl and Tk.
	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
	    if test x"${TK_BIN_DIR}" != x ; then
		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
	    fi




	    eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
	else
	    eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"


	fi

	# Some packages build their own stubs libraries
	eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
	if test "$GCC" = "yes"; then
	    PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
	fi
	# These aren't needed on Windows (either MSVC or gcc)
	RANLIB=:
	RANLIB_STUB=:
    else
	RANLIB_STUB="${RANLIB}"
	if test "${SHARED_BUILD}" = "1" ; then
	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
	    if test x"${TK_BIN_DIR}" != x ; then
		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
	    fi
	    eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
	    RANLIB=:
	else
	    eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
	fi
	# Some packages build their own stubs libraries
	eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
    fi

    # These are escaped so that only CFLAGS is picked up at configure time.
    # The other values will be substituted at make time.
    CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
    if test "${SHARED_BUILD}" = "1" ; then
	CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
................................................................................


    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5
$as_echo_n "checking for tclsh... " >&6; }
    if test -f "${TCL_BIN_DIR}/Makefile" ; then
        # tclConfig.sh is in Tcl build directory
        if test "${TEA_PLATFORM}" = "windows"; then

            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"







        else
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
        fi
    else
        # tclConfig.sh is in install location
        if test "${TEA_PLATFORM}" = "windows"; then
            TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"







>













>
>
>
>
>
>







 







>







 







>
>







 







|





|

|


|
|
|







 







|







 







<

|







 







>

|


>
>







 







>
|
>
>

>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|

|





|

|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|



>







>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>







 







|
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






|







 







|




|
|







 







|







 







>


>







 







|
|
<


|
>
>
|
|
|

|

|
|
<
|
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|





|








>
>
|
|
|
|
|
>
>







 







|
|







 







<
<
<







 







|











|
|
|







 







|
|
|
|







 







>







 







<







 







|







 







|







 







<



>
>
>
>
|

|
>
>
|
>

|













|


|


|







 







>

>
>
>
>
>
>
>







638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
...
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
....
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
....
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
....
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
....
2252
2253
2254
2255
2256
2257
2258

2259
2260
2261
2262
2263
2264
2265
2266
2267
....
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
....
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
....
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
....
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
....
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
....
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
....
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
....
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
....
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
....
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
....
7324
7325
7326
7327
7328
7329
7330
7331
7332

7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345

7346





7347


































7348
7349
7350
7351
7352
7353
7354
....
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
....
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
....
8022
8023
8024
8025
8026
8027
8028



8029
8030
8031
8032
8033
8034
8035
....
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
....
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
....
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
....
8211
8212
8213
8214
8215
8216
8217

8218
8219
8220
8221
8222
8223
8224
....
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
....
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
....
8690
8691
8692
8693
8694
8695
8696

8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
....
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
STLIB_LD
CFLAGS_WARNING
CFLAGS_OPTIMIZE
CFLAGS_DEBUG
RC
CELIB_DIR
AR
STUBS_BUILD
SHARED_BUILD
TCL_THREADS
TCL_INCLUDES
PKG_OBJECTS
PKG_SOURCES
TDOM_SRC_DIR
TDOM_STUB_LIB_SPEC
TDOM_VERSION
MATH_LIBS
EGREP
GREP
RANLIB
SET_MAKE
INSTALL_LIBRARY
INSTALL_SCRIPT
INSTALL_PROGRAM
INSTALL_DATA
INSTALL_DATA_DIR
INSTALL
CPP
TCL_SHLIB_LD_LIBS
TCL_LD_FLAGS
TCL_EXTRA_CFLAGS
TCL_DEFS
TCL_LIBS
CLEANFILES
................................................................................
ac_user_opts='
enable_option_checking
with_tcl
with_tdom
with_tclinclude
enable_threads
enable_shared
enable_stubs
enable_64bit
enable_64bit_vis
enable_rpath
enable_wince
with_celib
enable_symbols
'
................................................................................

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-threads        build with threads
  --enable-shared         build and link with shared libraries (default: on)
  --enable-stubs          build and link with stub libraries. Always true for
                          shared builds (default: on)
  --enable-64bit          enable 64bit support (default: off)
  --enable-64bit-vis      enable 64bit Sparc VIS support (default: off)
  --disable-rpath         disable rpath support (default: on)
  --enable-wince          enable Win/CE support (where applicable)
  --enable-symbols        build with debugging symbols (default: off)

Optional Packages:
................................................................................
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------


    # TEA extensions pass this us the version of TEA they think they
    # are compatible with.
    TEA_VERSION="3.10"

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct TEA configuration" >&5
$as_echo_n "checking for correct TEA configuration... " >&6; }
    if test x"${PACKAGE_NAME}" = x ; then
	as_fn_error $? "
The PACKAGE_NAME variable must be defined by your TEA configure.ac" "$LINENO" 5
    fi
    if test x"3.10" = x ; then
	as_fn_error $? "
TEA version not specified." "$LINENO" 5
    elif test "3.10" != "${TEA_VERSION}" ; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"3.10\", have \"${TEA_VERSION}\"" >&5
$as_echo "warning: requested TEA version \"3.10\", have \"${TEA_VERSION}\"" >&6; }
    else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5
$as_echo "ok (TEA ${TEA_VERSION})" >&6; }
    fi

    # If the user did not set CFLAGS, set it now to keep macros
    # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2".
................................................................................
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    for ac_exec_ext in '' $ac_executable_extensions; do
  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CYGPATH="cygpath -m"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

................................................................................
fi


	    EXEEXT=".exe"
	    TEA_PLATFORM="windows"
	    ;;
	*CYGWIN_*)

	    EXEEXT=".exe"
	    # CYGPATH and TEA_PLATFORM are determined later in LOAD_TCLCONFIG
	    ;;
	*)
	    CYGPATH=echo
	    # Maybe we are cross-compiling....
	    case ${host_alias} in
		*mingw32*)
		EXEEXT=".exe"
................................................................................
	    fi

	    # check in a few common install locations
	    if test x"${ac_cv_c_tclconfig}" = x ; then
		for i in `ls -d ${libdir} 2>/dev/null` \
			`ls -d ${exec_prefix}/lib 2>/dev/null` \
			`ls -d ${prefix}/lib 2>/dev/null` \
			`ls -d /usr/contrib/lib 2>/dev/null` \
			`ls -d /usr/local/lib 2>/dev/null` \
			`ls -d /usr/pkg/lib 2>/dev/null` \
			`ls -d /usr/lib 2>/dev/null` \
			`ls -d /usr/lib64 2>/dev/null` \
			`ls -d /usr/lib/tcl8.6 2>/dev/null` \
			`ls -d /usr/lib/tcl8.5 2>/dev/null` \
			; do
		    if test -f "$i/tclConfig.sh" ; then
			ac_cv_c_tclconfig="`(cd $i; pwd)`"
			break
		    fi
		done
	    fi
................................................................................
	    #endif

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :

	    TEA_PLATFORM="unix"
	    CYGPATH=echo

else

	    TEA_PLATFORM="windows"
	    # Extract the first word of "cygpath", so it can be a program name with args.
set dummy cygpath; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CYGPATH+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$CYGPATH"; then
  ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    for ac_exec_ext in '' $ac_executable_extensions; do
  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CYGPATH="cygpath -m"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo"
fi
fi
CYGPATH=$ac_cv_prog_CYGPATH
if test -n "$CYGPATH"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGPATH" >&5
$as_echo "$CYGPATH" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    CC=$hold_cc
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEA_PLATFORM" >&5
$as_echo "$TEA_PLATFORM" >&6; }

................................................................................
fi

ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu


    INSTALL='$(SHELL) $(srcdir)/tclconfig/install-sh -c'
    INSTALL_DATA_DIR='${INSTALL} -d -m 755'
    INSTALL_DATA='${INSTALL} -m 644'
    INSTALL_PROGRAM='${INSTALL}'
    INSTALL_SCRIPT='${INSTALL}'
    INSTALL_LIBRARY='${INSTALL_DATA}'








    #--------------------------------------------------------------------
    # Checks to see if the make program sets the $MAKE variable.
    #--------------------------------------------------------------------

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
................................................................................
#--------------------------------------------------------------------


    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5
$as_echo_n "checking how to build libraries... " >&6; }
    # Check whether --enable-shared was given.
if test "${enable_shared+set}" = set; then :
  enableval=$enable_shared; shared_ok=$enableval
else
  shared_ok=yes
fi


    if test "${enable_shared+set}" = set; then
	enableval="$enable_shared"
	shared_ok=$enableval
    else
	shared_ok=yes
    fi

    # Check whether --enable-stubs was given.
if test "${enable_stubs+set}" = set; then :
  enableval=$enable_stubs; stubs_ok=$enableval
else
  stubs_ok=yes
fi


    if test "${enable_stubs+set}" = set; then
	enableval="$enable_stubs"
	stubs_ok=$enableval
    else
	stubs_ok=yes
    fi

    # Stubs are always enabled for shared builds
    if test "$shared_ok" = "yes" ; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: shared" >&5
$as_echo "shared" >&6; }
	SHARED_BUILD=1
        STUBS_BUILD=1
    else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5
$as_echo "static" >&6; }
	SHARED_BUILD=0

$as_echo "#define STATIC_BUILD 1" >>confdefs.h

        if test "$stubs_ok" = "yes" ; then
          STUBS_BUILD=1
        else
          STUBS_BUILD=0
        fi
    fi
    if test "${STUBS_BUILD}" = "1" ; then

$as_echo "#define USE_TCL_STUBS 1" >>confdefs.h


$as_echo "#define USE_TCLOO_STUBS 1" >>confdefs.h

      if test "${TEA_WINDOWINGSYSTEM}" != ""; then

$as_echo "#define USE_TK_STUBS 1" >>confdefs.h

      fi
    fi





#--------------------------------------------------------------------
# This macro figures out what flags to use with the compiler/linker
# when building shared/static debug/optimized objects.  This information
# can be taken from the tclConfig.sh file, but this figures it all out.
................................................................................
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_visibility_hidden" >&5
$as_echo "$tcl_cv_cc_visibility_hidden" >&6; }
    if test $tcl_cv_cc_visibility_hidden = yes; then :


$as_echo "#define MODULE_SCOPE extern __attribute__((__visibility__(\"hidden\")))" >>confdefs.h


$as_echo "#define HAVE_HIDDEN 1" >>confdefs.h


fi

    # Step 0.d: Disable -rpath support?

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if rpath support is requested" >&5
$as_echo_n "checking if rpath support is requested... " >&6; }
................................................................................
else
  AR="$ac_cv_prog_AR"
fi

    STLIB_LD='${AR} cr'
    LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
    if test "x$SHLIB_VERSION" = x; then :
  SHLIB_VERSION=""
else
  SHLIB_VERSION=".$SHLIB_VERSION"
fi
    case $system in
	# TEA specific:
	windows)
	    # This is a 2-stage check to make sure we have the 64-bit SDK
	    # We have to know where the SDK is installed.
	    # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
................................................................................

	    if test "$GCC" != "yes" ; then
	        if test "${SHARED_BUILD}" = "0" ; then
		    runtime=-MT
	        else
		    runtime=-MD
	        fi
	        case "x`echo \${VisualStudioVersion}`" in
	            x1[4-9]*)
		        lflags="${lflags} -nodefaultlib:libucrt.lib"

    vars="ucrt.lib"
    for i in $vars; do
	if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
	    # Convert foo.lib to -lfoo for GCC.  No-op if not *.lib
	    i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'`
	fi
	PKG_LIBS="$PKG_LIBS $i"
    done


	            ;;
	            *)
	            ;;
	        esac

                if test "$do64bit" != "no" ; then
		    # All this magic is necessary for the Win64 SDK RC1 - hobbs
		    CC="\"${PATH64}/cl.exe\""
		    CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
		    RC="\"${MSSDK}/bin/rc.exe\""
		    lflags="${lflags} -nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
		    LINKBIN="\"${PATH64}/link.exe\""
		    CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
		    # Avoid 'unresolved external symbol __security_cookie'
		    # errors, c.f. http://support.microsoft.com/?id=894573

    vars="bufferoverflowU.lib"
................................................................................
cat >>confdefs.h <<_ACEOF
#define UNDER_CE $CEVERSION
_ACEOF

		    CFLAGS_DEBUG="-nologo -Zi -Od"
		    CFLAGS_OPTIMIZE="-nologo -Ox"
		    lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
		    lflags="${lflags} -MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
		    LINKBIN="\"${CEBINROOT}/link.exe\""

		else
		    RC="rc"
		    lflags="${lflags} -nologo"
		    LINKBIN="link"
		    CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
		fi
	    fi

	    if test "$GCC" = "yes"; then
		# mingw gcc mode
................................................................................
$as_echo_n "checking for cross-compile version of gcc... " >&6; }
if ${ac_cv_cross+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

			    #ifdef _WIN32
				#error cross-compiler
			    #endif

int
main ()
{

................................................................................
	    LDFLAGS="$LDFLAGS -export-dynamic"
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
	    ;;
	CYGWIN_*)
	    SHLIB_CFLAGS=""
	    SHLIB_LD='${CC} -shared'
	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$@.a"
	    SHLIB_SUFFIX=".dll"
	    EXEEXT=".exe"
	    do64bit_ok=yes
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
	    ;;
	Haiku*)
	    LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
	    SHLIB_CFLAGS="-fPIC"
	    SHLIB_SUFFIX=".so"
................................................................................
		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
	    ;;
	OpenBSD-*)
	    arch=`arch -s`
	    case "$arch" in
	    alpha|sparc64)
		SHLIB_CFLAGS="-fPIC"

		;;
	    *)
		SHLIB_CFLAGS="-fpic"
		;;
	    esac
	    SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
	    SHLIB_SUFFIX=".so"
	    if test $doRpath = yes; then :

		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
	    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'

	    LDFLAGS="-Wl,-export-dynamic"





	    CFLAGS_OPTIMIZE="-O2"


































	    if test "${TCL_THREADS}" = "1"; then :

		# On OpenBSD:	Compile with -pthread
		#		Don't link with -lpthread
		LIBS=`echo $LIBS | sed s/-lpthread//`
		CFLAGS="$CFLAGS -pthread"

................................................................................

fi
	    ;;
	FreeBSD-*)
	    # This configuration from FreeBSD Ports.
	    SHLIB_CFLAGS="-fPIC"
	    SHLIB_LD="${CC} -shared"
	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$@"
	    SHLIB_SUFFIX=".so"
	    LDFLAGS=""
	    if test $doRpath = yes; then :

		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
	    if test "${TCL_THREADS}" = "1"; then :

		# The -pthread needs to go in the LDFLAGS, not LIBS
		LIBS=`echo $LIBS | sed s/-pthread//`
		CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
		LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
fi
	    case $system in
	    FreeBSD-3.*)
		# Version numbers are dot-stripped by system policy.
		TCL_TRIM_DOTS=`echo ${PACKAGE_VERSION} | tr -d .`
		UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1'
		TCL_LIB_VERSIONS_OK=nodots
		;;
	    esac
	    ;;
	Darwin-*)
	    CFLAGS_OPTIMIZE="-Os"
	    SHLIB_CFLAGS="-fno-common"
	    # To avoid discrepancies between what headers configure sees during
	    # preprocessing tests and compiling tests, move any -isysroot and
	    # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
................................................................................
	    if test "$GCC" = yes; then :

		SHLIB_CFLAGS="-fPIC -melf"
		LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"

else

		SHLIB_CFLAGS="-Kpic -belf"
		LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"

fi
	    SHLIB_LD="ld -G"
	    SHLIB_LD_LIBS=""
	    SHLIB_SUFFIX=".so"
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
................................................................................
fi

    if test "$tcl_cv_cc_visibility_hidden" != yes; then :


$as_echo "#define MODULE_SCOPE extern" >>confdefs.h





fi

    if test "$SHARED_LIB_SUFFIX" = ""; then :

    # TEA specific: use PACKAGE_VERSION instead of VERSION
    SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'
................................................................................
fi
    if test "$UNSHARED_LIB_SUFFIX" = ""; then :

    # TEA specific: use PACKAGE_VERSION instead of VERSION
    UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'
fi

    if test "${GCC}" = "yes" -a ${SHLIB_SUFFIX} = ".dll"; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SEH support in compiler" >&5
$as_echo_n "checking for SEH support in compiler... " >&6; }
if ${tcl_cv_seh+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  tcl_cv_seh=no
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN

	    int main(int argc, char** argv) {
		int a, b = 0;
		__try {
		    a = 666 / b;
		}
		__except (EXCEPTION_EXECUTE_HANDLER) {
................................................................................
$as_echo_n "checking for winnt.h that ignores VOID define... " >&6; }
if ${tcl_cv_winnt_ignore_void+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#define VOID void
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN

int
main ()
{

		CHAR c;
		SHORT s;
................................................................................
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_winnt_ignore_void" >&5
$as_echo "$tcl_cv_winnt_ignore_void" >&6; }
	if test "$tcl_cv_winnt_ignore_void" = "yes" ; then

$as_echo "#define HAVE_WINNT_IGNORE_VOID 1" >>confdefs.h

	fi
    fi

	# See if the compiler supports casting to a union type.
	# This is used to stop gcc from printing a compiler
	# warning when initializing a union member.

	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5
$as_echo_n "checking for cast to union support... " >&6; }
................................................................................
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5
$as_echo "$tcl_cv_cast_to_union" >&6; }
	if test "$tcl_cv_cast_to_union" = "yes"; then

$as_echo "#define HAVE_CAST_TO_UNION 1" >>confdefs.h

	fi








................................................................................
if ${tcl_cv_struct_dirent64+:} false; then :
  $as_echo_n "(cached) " >&6
else

	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <sys/types.h>
#include <dirent.h>
int
main ()
{
struct dirent64 p;
  ;
  return 0;
}
................................................................................

    CLEANFILES="$CLEANFILES *.manifest"


fi
rm -f conftest*

	MAKE_STUB_LIB="\${STLIB_LD} -nodefaultlib -out:\$@ \$(PKG_STUB_OBJECTS)"
    else
	MAKE_STATIC_LIB="\${STLIB_LD} \$@ \$(PKG_OBJECTS)"
	MAKE_SHARED_LIB="\${SHLIB_LD} -o \$@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
	MAKE_STUB_LIB="\${STLIB_LD} \$@ \$(PKG_STUB_OBJECTS)"
    fi

    if test "${SHARED_BUILD}" = "1" ; then
................................................................................
    # substituted. (@@@ Might not be necessary anymore)
    #--------------------------------------------------------------------

    if test "${TEA_PLATFORM}" = "windows" ; then
	if test "${SHARED_BUILD}" = "1" ; then
	    # We force the unresolved linking of symbols that are really in
	    # the private libraries of Tcl and Tk.

	    if test x"${TK_BIN_DIR}" != x ; then
		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
	    fi
	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
	    if test "$GCC" = "yes"; then
		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -static-libgcc"
	    fi
	    eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
	else
	    eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
	    if test "$GCC" = "yes"; then
		PKG_LIB_FILE=lib${PKG_LIB_FILE}
	    fi
	fi
	# Some packages build their own stubs libraries
	eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
	if test "$GCC" = "yes"; then
	    PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
	fi
	# These aren't needed on Windows (either MSVC or gcc)
	RANLIB=:
	RANLIB_STUB=:
    else
	RANLIB_STUB="${RANLIB}"
	if test "${SHARED_BUILD}" = "1" ; then
	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
	    if test x"${TK_BIN_DIR}" != x ; then
		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
	    fi
	    eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
	    RANLIB=:
	else
	    eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
	fi
	# Some packages build their own stubs libraries
	eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
    fi

    # These are escaped so that only CFLAGS is picked up at configure time.
    # The other values will be substituted at make time.
    CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
    if test "${SHARED_BUILD}" = "1" ; then
	CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
................................................................................


    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5
$as_echo_n "checking for tclsh... " >&6; }
    if test -f "${TCL_BIN_DIR}/Makefile" ; then
        # tclConfig.sh is in Tcl build directory
        if test "${TEA_PLATFORM}" = "windows"; then
          if test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
          elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}s${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}s${EXEEXT}"
          elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}t${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}t${EXEEXT}"
          elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}st${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}st${EXEEXT}"
          fi
        else
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
        fi
    else
        # tclConfig.sh is in install location
        if test "${TEA_PLATFORM}" = "windows"; then
            TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"

Changes to extensions/example/configure.in.

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------

TEA_INIT([3.9])

AC_CONFIG_AUX_DIR(../../tclconfig)

#--------------------------------------------------------------------
# Load the tclConfig.sh file
#--------------------------------------------------------------------








|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------

TEA_INIT([3.10])

AC_CONFIG_AUX_DIR(../../tclconfig)

#--------------------------------------------------------------------
# Load the tclConfig.sh file
#--------------------------------------------------------------------

Added extensions/tdomhtml/win/makefile.vc.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Simple makefile for pure Tcl package

PROJECT    = tdomhtml
DOTVERSION = 0.1.0
VERSION    = $(DOTVERSION:.=)

CPY	= echo y | xcopy /i >NUL

!ifndef INSTALLDIR
### Assume the normal default.
_INSTALLDIR	= C:\Program Files\Tcl\lib
!else
### Fix the path separators.
_INSTALLDIR	= $(INSTALLDIR:/=\)\lib
!endif


PRJ_INSTALL_DIR         = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION)
DOC_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
SCRIPT_INSTALL_DIR	= $(PRJ_INSTALL_DIR)

all:
	@echo This is a pure Tcl package. Just run 'make /f makefile.vc install INSTALLDIR=path\to\tcl\root'

install: install-libraries

install-libraries:
	@if not exist $(SCRIPT_INSTALL_DIR)\nul mkdir $(SCRIPT_INSTALL_DIR)
	@echo Installing libraries to '$(SCRIPT_INSTALL_DIR)'
        $(CPY) ..\tdomhtml.tcl "$(SCRIPT_INSTALL_DIR)" >NUL
        @echo Installing package index in '$(SCRIPT_INSTALL_DIR)'
        @type << >"$(SCRIPT_INSTALL_DIR)\pkgIndex.tcl"
    package ifneeded tdomhtml $(DOTVERSION) "set _V_ $(DOTVERSION); source [list [file join $$dir tdomhtml.tcl]]"
<<

install-docs:
#	@echo Installing documentation files to '$(DOC_INSTALL_DIR)'
#	@if exist $(DOCDIR) $(CPY) $(DOCDIR)\*.n "$(DOC_INSTALL_DIR)"

Changes to extensions/tnc/Makefile.in.

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
...
292
293
294
295
296
297
298










299
300
301
302
303
304
305
pkgdatadir	= $(datadir)/$(PKG_DIR)
pkglibdir	= $(libdir)/$(PKG_DIR)
pkgincludedir	= $(includedir)/$(PKG_DIR)

top_builddir	= .

INSTALL_OPTIONS =
INSTALL		= $(SHELL) $(srcdir)/tclconfig/install-sh -c ${INSTALL_OPTIONS}
INSTALL_DATA_DIR = ${INSTALL} -d -m 755
INSTALL_PROGRAM	= ${INSTALL} -m 555
INSTALL_DATA	= ${INSTALL} -m 444
INSTALL_SCRIPT	= ${INSTALL_PROGRAM}
INSTALL_LIBRARY	= ${INSTALL_DATA}

PACKAGE_NAME	= @PACKAGE_NAME@
................................................................................
# TEA TARGETS.  Please note that the "libraries:" target refers to platform
# independent files, and the "binaries:" target includes executable programs and
# platform-dependent libraries.  Modify these targets so that they install
# the various pieces of your package.  The make and install rules
# for the BINARIES that you specified above have already been done.
#========================================================================

all: binaries libraries doc

#========================================================================
# The binaries target builds executable programs, Windows .dll's, unix
# shared/static libraries, and any other platform-dependent files.
# The list of targets to build for "binaries:" is specified at the top
# of the Makefile, in the "BINARIES" variable.
#========================================================================

binaries: $(BINARIES)

libraries:

#========================================================================
# Your doc target should differentiate from doc builds (by the developer)
# and doc installs (see install-doc), which just install the docs on the
# end user machine when building from source.
#========================================================================

doc:
	@echo "If you have documentation to create, place the commands to"
	@echo "build the docs in the 'doc:' target.  For example:"
	@echo "        xml2nroff sample.xml > sample.n"
	@echo "        xml2html sample.xml > sample.html"

install: all install-binaries install-libraries install-doc

install-binaries: binaries install-lib-binaries install-bin-binaries

#========================================================================
# This rule installs platform-independent files, such as header files.
# The list=...; for p in $$list handles the empty list case x-platform.
#========================================================================

install-libraries: libraries
	@$(INSTALL_DATA_DIR) $(DESTDIR)$(includedir)
	@echo "Installing header files in $(DESTDIR)$(includedir)"
	@list='$(PKG_HEADERS)'; for i in $$list; do \
	    echo "Installing $(srcdir)/$$i" ; \
	    $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \
	done;

#========================================================================
# Install documentation.  Unix manpages should go in the $(mandir)
# directory.
#========================================================================

install-doc: doc
................................................................................
# As necessary, add $(srcdir):$(srcdir)/compat:....
#========================================================================

VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win:$(srcdir)/macosx

.c.@OBJEXT@:
	$(COMPILE) -c `@CYGPATH@ $<` -o $@











#========================================================================
# Distribution creation
# You may need to tweak this target to make it work correctly.
#========================================================================

#COMPRESS	= tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar







|







 







|








|










<
<
<
<

|










<
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203




204
205
206
207
208
209
210
211
212
213
214
215





216
217
218
219
220
221
222
...
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
pkgdatadir	= $(datadir)/$(PKG_DIR)
pkglibdir	= $(libdir)/$(PKG_DIR)
pkgincludedir	= $(includedir)/$(PKG_DIR)

top_builddir	= .

INSTALL_OPTIONS =
INSTALL		= $(SHELL) $(srcdir)/../../tclconfig/install-sh -c ${INSTALL_OPTIONS}
INSTALL_DATA_DIR = ${INSTALL} -d -m 755
INSTALL_PROGRAM	= ${INSTALL} -m 555
INSTALL_DATA	= ${INSTALL} -m 444
INSTALL_SCRIPT	= ${INSTALL_PROGRAM}
INSTALL_LIBRARY	= ${INSTALL_DATA}

PACKAGE_NAME	= @PACKAGE_NAME@
................................................................................
# TEA TARGETS.  Please note that the "libraries:" target refers to platform
# independent files, and the "binaries:" target includes executable programs and
# platform-dependent libraries.  Modify these targets so that they install
# the various pieces of your package.  The make and install rules
# for the BINARIES that you specified above have already been done.
#========================================================================

all: binaries libraries

#========================================================================
# The binaries target builds executable programs, Windows .dll's, unix
# shared/static libraries, and any other platform-dependent files.
# The list of targets to build for "binaries:" is specified at the top
# of the Makefile, in the "BINARIES" variable.
#========================================================================

binaries: $(BINARIES) pkgIndex.tcl-hand

libraries:

#========================================================================
# Your doc target should differentiate from doc builds (by the developer)
# and doc installs (see install-doc), which just install the docs on the
# end user machine when building from source.
#========================================================================

doc:





install: all install-binaries install-libraries

install-binaries: binaries install-lib-binaries install-bin-binaries

#========================================================================
# This rule installs platform-independent files, such as header files.
# The list=...; for p in $$list handles the empty list case x-platform.
#========================================================================

install-libraries: libraries
	@$(INSTALL_DATA_DIR) $(DESTDIR)$(includedir)






#========================================================================
# Install documentation.  Unix manpages should go in the $(mandir)
# directory.
#========================================================================

install-doc: doc
................................................................................
# As necessary, add $(srcdir):$(srcdir)/compat:....
#========================================================================

VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win:$(srcdir)/macosx

.c.@OBJEXT@:
	$(COMPILE) -c `@CYGPATH@ $<` -o $@

#========================================================================
# Create the pkgIndex.tcl file.
#========================================================================

pkgIndex.tcl-hand:
	@(echo 'package ifneeded $(PACKAGE_NAME) $(PACKAGE_VERSION) \
	"package require tdom;\
	 load [list [file join $$dir $(PKG_LIB_FILE)]];"'\
	) > pkgIndex.tcl

#========================================================================
# Distribution creation
# You may need to tweak this target to make it work correctly.
#========================================================================

#COMPRESS	= tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar

Changes to extensions/tnc/configure.

638
639
640
641
642
643
644

645
646
647
648
649
650
651
652
653
654
655
656
657






658
659
660
661
662
663
664
...
731
732
733
734
735
736
737

738
739
740
741
742
743
744
....
1358
1359
1360
1361
1362
1363
1364


1365
1366
1367
1368
1369
1370
1371
....
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
....
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
....
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
....
2427
2428
2429
2430
2431
2432
2433

2434
2435
2436
2437


2438
2439
2440
2441
2442
2443
2444
....
3350
3351
3352
3353
3354
3355
3356

3357


3358

3359






































3360
3361
3362
3363
3364
3365
3366
....
4107
4108
4109
4110
4111
4112
4113














4114
4115
4116
4117
4118
4119
4120
....
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
....
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
















5961
5962
5963
5964

5965
5966
5967
5968
5969
5970
5971




5972
















5973
5974
5975
5976
5977
5978
5979
....
6141
6142
6143
6144
6145
6146
6147



6148
6149
6150
6151
6152
6153
6154
....
6335
6336
6337
6338
6339
6340
6341
6342


6343
6344
6345
6346
6347
6348
6349
....
6499
6500
6501
6502
6503
6504
6505


















6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
....
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
....
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
....
6885
6886
6887
6888
6889
6890
6891

6892
6893

6894
6895
6896
6897
6898
6899
6900
....
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209


7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
....
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310


7311
7312
7313
7314
7315


7316
7317
7318
7319
7320
7321
7322
....
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
....
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
....
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
....
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
....
8082
8083
8084
8085
8086
8087
8088

8089
8090
8091
8092
8093
8094
8095
....
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
....
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
....
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
....
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611




8612
8613
8614


8615

8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
....
8663
8664
8665
8666
8667
8668
8669

8670







8671
8672
8673
8674
8675
8676
8677
STLIB_LD
CFLAGS_WARNING
CFLAGS_OPTIMIZE
CFLAGS_DEBUG
RC
CELIB_DIR
AR

SHARED_BUILD
TCL_THREADS
TCL_INCLUDES
PKG_OBJECTS
PKG_SOURCES
TDOM_SRC_DIR
TDOM_STUB_LIB_SPEC
TDOM_VERSION
MATH_LIBS
EGREP
GREP
RANLIB
SET_MAKE






CPP
TCL_SHLIB_LD_LIBS
TCL_LD_FLAGS
TCL_EXTRA_CFLAGS
TCL_DEFS
TCL_LIBS
CLEANFILES
................................................................................
ac_user_opts='
enable_option_checking
with_tcl
with_tdom
with_tclinclude
enable_threads
enable_shared

enable_64bit
enable_64bit_vis
enable_rpath
enable_wince
with_celib
enable_symbols
'
................................................................................

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-threads        build with threads
  --enable-shared         build and link with shared libraries (default: on)


  --enable-64bit          enable 64bit support (default: off)
  --enable-64bit-vis      enable 64bit Sparc VIS support (default: off)
  --disable-rpath         disable rpath support (default: on)
  --enable-wince          enable Win/CE support (where applicable)
  --enable-symbols        build with debugging symbols (default: off)

Optional Packages:
................................................................................
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------


    # TEA extensions pass this us the version of TEA they think they
    # are compatible with.
    TEA_VERSION="3.9"

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct TEA configuration" >&5
$as_echo_n "checking for correct TEA configuration... " >&6; }
    if test x"${PACKAGE_NAME}" = x ; then
	as_fn_error $? "
The PACKAGE_NAME variable must be defined by your TEA configure.in" "$LINENO" 5
    fi
    if test x"3.9" = x ; then
	as_fn_error $? "
TEA version not specified." "$LINENO" 5
    elif test "3.9" != "${TEA_VERSION}" ; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&5
$as_echo "warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&6; }
    else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5
$as_echo "ok (TEA ${TEA_VERSION})" >&6; }
    fi

    # If the user did not set CFLAGS, set it now to keep macros
    # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2".
................................................................................
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    for ac_exec_ext in '' $ac_executable_extensions; do
  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CYGPATH="cygpath -w"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

................................................................................
fi


	    EXEEXT=".exe"
	    TEA_PLATFORM="windows"
	    ;;
	*CYGWIN_*)
	    CYGPATH=echo
	    EXEEXT=".exe"
	    # TEA_PLATFORM is determined later in LOAD_TCLCONFIG
	    ;;
	*)
	    CYGPATH=echo
	    # Maybe we are cross-compiling....
	    case ${host_alias} in
		*mingw32*)
		EXEEXT=".exe"
................................................................................
	    fi

	    # check in a few common install locations
	    if test x"${ac_cv_c_tclconfig}" = x ; then
		for i in `ls -d ${libdir} 2>/dev/null` \
			`ls -d ${exec_prefix}/lib 2>/dev/null` \
			`ls -d ${prefix}/lib 2>/dev/null` \

			`ls -d /usr/local/lib 2>/dev/null` \
			`ls -d /usr/contrib/lib 2>/dev/null` \
			`ls -d /usr/lib 2>/dev/null` \
			`ls -d /usr/lib64 2>/dev/null` \


			; do
		    if test -f "$i/tclConfig.sh" ; then
			ac_cv_c_tclconfig="`(cd $i; pwd)`"
			break
		    fi
		done
	    fi
................................................................................
	    #endif

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :

  TEA_PLATFORM="unix"


else

  TEA_PLATFORM="windows"







































fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    CC=$hold_cc
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEA_PLATFORM" >&5
$as_echo "$TEA_PLATFORM" >&6; }

................................................................................
fi

ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
















    #--------------------------------------------------------------------
    # Checks to see if the make program sets the $MAKE variable.
    #--------------------------------------------------------------------

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
................................................................................
# You can add more files to clean if your extension creates any extra
# files.
#
# TEA_ADD_* any platform specific compiler/build info here.
#--------------------------------------------------------------------

if test "${TEA_PLATFORM}" = "windows" ; then

$as_echo "#define BUILD_tnc 1" >>confdefs.h

    CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch"
    #TEA_ADD_SOURCES([win/winFile.c])
    #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
else
    CLEANFILES="pkgIndex.tcl"
    #TEA_ADD_SOURCES([unix/unixFile.c])
    #TEA_ADD_LIBS([-lsuperfly])
................................................................................
#--------------------------------------------------------------------


    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5
$as_echo_n "checking how to build libraries... " >&6; }
    # Check whether --enable-shared was given.
if test "${enable_shared+set}" = set; then :
  enableval=$enable_shared; tcl_ok=$enableval
else
  tcl_ok=yes
fi


    if test "${enable_shared+set}" = set; then
	enableval="$enable_shared"
	tcl_ok=$enableval
    else
	tcl_ok=yes
    fi

















    if test "$tcl_ok" = "yes" ; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: shared" >&5
$as_echo "shared" >&6; }
	SHARED_BUILD=1

    else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5
$as_echo "static" >&6; }
	SHARED_BUILD=0

$as_echo "#define STATIC_BUILD 1" >>confdefs.h





    fi



















#--------------------------------------------------------------------
# This macro figures out what flags to use with the compiler/linker
# when building shared/static debug/optimized objects.  This information
# can be taken from the tclConfig.sh file, but this figures it all out.
................................................................................
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_visibility_hidden" >&5
$as_echo "$tcl_cv_cc_visibility_hidden" >&6; }
    if test $tcl_cv_cc_visibility_hidden = yes; then :


$as_echo "#define MODULE_SCOPE extern __attribute__((__visibility__(\"hidden\")))" >>confdefs.h





fi

    # Step 0.d: Disable -rpath support?

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if rpath support is requested" >&5
$as_echo_n "checking if rpath support is requested... " >&6; }
................................................................................
else
  AR="$ac_cv_prog_AR"
fi

    STLIB_LD='${AR} cr'
    LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
    if test "x$SHLIB_VERSION" = x; then :
  SHLIB_VERSION="1.0"


fi
    case $system in
	# TEA specific:
	windows)
	    # This is a 2-stage check to make sure we have the 64-bit SDK
	    # We have to know where the SDK is installed.
	    # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
................................................................................

	    if test "$GCC" != "yes" ; then
	        if test "${SHARED_BUILD}" = "0" ; then
		    runtime=-MT
	        else
		    runtime=-MD
	        fi



















                if test "$do64bit" != "no" ; then
		    # All this magic is necessary for the Win64 SDK RC1 - hobbs
		    CC="\"${PATH64}/cl.exe\""
		    CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
		    RC="\"${MSSDK}/bin/rc.exe\""
		    lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
		    LINKBIN="\"${PATH64}/link.exe\""
		    CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
		    # Avoid 'unresolved external symbol __security_cookie'
		    # errors, c.f. http://support.microsoft.com/?id=894573

    vars="bufferoverflowU.lib"
................................................................................
cat >>confdefs.h <<_ACEOF
#define UNDER_CE $CEVERSION
_ACEOF

		    CFLAGS_DEBUG="-nologo -Zi -Od"
		    CFLAGS_OPTIMIZE="-nologo -Ox"
		    lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
		    lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
		    LINKBIN="\"${CEBINROOT}/link.exe\""

		else
		    RC="rc"
		    lflags="-nologo"
    		    LINKBIN="link"
		    CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
		fi
	    fi

	    if test "$GCC" = "yes"; then
		# mingw gcc mode
................................................................................
$as_echo_n "checking for cross-compile version of gcc... " >&6; }
if ${ac_cv_cross+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

			    #ifdef __WIN32__
				#error cross-compiler
			    #endif

int
main ()
{

................................................................................
	    LDFLAGS="$LDFLAGS -export-dynamic"
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
	    ;;
	CYGWIN_*)
	    SHLIB_CFLAGS=""
	    SHLIB_LD='${CC} -shared'

	    SHLIB_SUFFIX=".dll"
	    EXEEXT=".exe"

	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
	    ;;
	Haiku*)
	    LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
	    SHLIB_CFLAGS="-fPIC"
	    SHLIB_SUFFIX=".so"
................................................................................
		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
	    ;;
	OpenBSD-*)
	    arch=`arch -s`
	    case "$arch" in
	    m88k|vax)
		SHLIB_SUFFIX=""
		SHARED_LIB_SUFFIX=""
		;;
	    *)
		SHLIB_CFLAGS="-fPIC"


		SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
		SHLIB_SUFFIX=".so"
		if test $doRpath = yes; then :

		    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
		;;
	    esac
	    case "$arch" in
	    m88k|vax)
		CFLAGS_OPTIMIZE="-O1"
		;;
	    *)
		CFLAGS_OPTIMIZE="-O2"
		;;
	    esac
	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF" >&5
$as_echo_n "checking for ELF... " >&6; }
if ${tcl_cv_ld_elf+:} false; then :
  $as_echo_n "(cached) " >&6
else

		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#ifdef __ELF__
	yes
#endif

_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  $EGREP "yes" >/dev/null 2>&1; then :
  tcl_cv_ld_elf=yes
else
  tcl_cv_ld_elf=no
fi
rm -f conftest*

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_elf" >&5
$as_echo "$tcl_cv_ld_elf" >&6; }
	    if test $tcl_cv_ld_elf = yes; then :

		LDFLAGS=-Wl,-export-dynamic

else
  LDFLAGS=""
fi
	    if test "${TCL_THREADS}" = "1"; then :

		# On OpenBSD:	Compile with -pthread
		#		Don't link with -lpthread
		LIBS=`echo $LIBS | sed s/-lpthread//`
		CFLAGS="$CFLAGS -pthread"

................................................................................

fi
	    ;;
	FreeBSD-*)
	    # This configuration from FreeBSD Ports.
	    SHLIB_CFLAGS="-fPIC"
	    SHLIB_LD="${CC} -shared"
	    TCL_SHLIB_LD_EXTRAS="-Wl,-soname \$@"
	    SHLIB_SUFFIX=".so"
	    LDFLAGS=""
	    if test $doRpath = yes; then :

		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
fi
	    if test "${TCL_THREADS}" = "1"; then :

		# The -pthread needs to go in the LDFLAGS, not LIBS
		LIBS=`echo $LIBS | sed s/-pthread//`
		CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
		LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
fi


	    # Version numbers are dot-stripped by system policy.
	    TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
	    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1'
	    TCL_LIB_VERSIONS_OK=nodots


	    ;;
	Darwin-*)
	    CFLAGS_OPTIMIZE="-Os"
	    SHLIB_CFLAGS="-fno-common"
	    # To avoid discrepancies between what headers configure sees during
	    # preprocessing tests and compiling tests, move any -isysroot and
	    # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
................................................................................
	    if test "$GCC" = yes; then :

		SHLIB_CFLAGS="-fPIC -melf"
		LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"

else

	       SHLIB_CFLAGS="-Kpic -belf"
	       LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"

fi
	    SHLIB_LD="ld -G"
	    SHLIB_LD_LIBS=""
	    SHLIB_SUFFIX=".so"
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
................................................................................
fi

    if test "$tcl_cv_cc_visibility_hidden" != yes; then :


$as_echo "#define MODULE_SCOPE extern" >>confdefs.h


$as_echo "#define NO_VIZ /**/" >>confdefs.h


fi

    if test "$SHARED_LIB_SUFFIX" = ""; then :

    # TEA specific: use PACKAGE_VERSION instead of VERSION
    SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'
................................................................................
fi
    if test "$UNSHARED_LIB_SUFFIX" = ""; then :

    # TEA specific: use PACKAGE_VERSION instead of VERSION
    UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'
fi

    if test "${GCC}" = "yes" ; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SEH support in compiler" >&5
$as_echo_n "checking for SEH support in compiler... " >&6; }
if ${tcl_cv_seh+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  tcl_cv_seh=no
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

	    #define WIN32_LEAN_AND_MEAN
	    #include <windows.h>
	    #undef WIN32_LEAN_AND_MEAN

	    int main(int argc, char** argv) {
		int a, b = 0;
		__try {
		    a = 666 / b;
		}
		__except (EXCEPTION_EXECUTE_HANDLER) {
................................................................................
$as_echo_n "checking for winnt.h that ignores VOID define... " >&6; }
if ${tcl_cv_winnt_ignore_void+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

		#define VOID void
		#define WIN32_LEAN_AND_MEAN
		#include <windows.h>
		#undef WIN32_LEAN_AND_MEAN

int
main ()
{

		CHAR c;
		SHORT s;
................................................................................
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_winnt_ignore_void" >&5
$as_echo "$tcl_cv_winnt_ignore_void" >&6; }
	if test "$tcl_cv_winnt_ignore_void" = "yes" ; then

$as_echo "#define HAVE_WINNT_IGNORE_VOID 1" >>confdefs.h

	fi


	# See if the compiler supports casting to a union type.
	# This is used to stop gcc from printing a compiler
	# warning when initializing a union member.

	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5
$as_echo_n "checking for cast to union support... " >&6; }
................................................................................
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5
$as_echo "$tcl_cv_cast_to_union" >&6; }
	if test "$tcl_cv_cast_to_union" = "yes"; then

$as_echo "#define HAVE_CAST_TO_UNION 1" >>confdefs.h

	fi
    fi







................................................................................
if ${tcl_cv_struct_dirent64+:} false; then :
  $as_echo_n "(cached) " >&6
else

	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <sys/types.h>
#include <sys/dirent.h>
int
main ()
{
struct dirent64 p;
  ;
  return 0;
}
................................................................................

    CLEANFILES="$CLEANFILES *.manifest"


fi
rm -f conftest*

	MAKE_STUB_LIB="\${STLIB_LD} -out:\$@ \$(PKG_STUB_OBJECTS)"
    else
	MAKE_STATIC_LIB="\${STLIB_LD} \$@ \$(PKG_OBJECTS)"
	MAKE_SHARED_LIB="\${SHLIB_LD} -o \$@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
	MAKE_STUB_LIB="\${STLIB_LD} \$@ \$(PKG_STUB_OBJECTS)"
    fi

    if test "${SHARED_BUILD}" = "1" ; then
................................................................................
    # substituted. (@@@ Might not be necessary anymore)
    #--------------------------------------------------------------------

    if test "${TEA_PLATFORM}" = "windows" ; then
	if test "${SHARED_BUILD}" = "1" ; then
	    # We force the unresolved linking of symbols that are really in
	    # the private libraries of Tcl and Tk.
	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
	    if test x"${TK_BIN_DIR}" != x ; then
		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
	    fi




	    eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
	else
	    eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"


	fi

	# Some packages build their own stubs libraries
	eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
	if test "$GCC" = "yes"; then
	    PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
	fi
	# These aren't needed on Windows (either MSVC or gcc)
	RANLIB=:
	RANLIB_STUB=:
    else
	RANLIB_STUB="${RANLIB}"
	if test "${SHARED_BUILD}" = "1" ; then
	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
	    if test x"${TK_BIN_DIR}" != x ; then
		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
	    fi
	    eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
	    RANLIB=:
	else
	    eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
	fi
	# Some packages build their own stubs libraries
	eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
    fi

    # These are escaped so that only CFLAGS is picked up at configure time.
    # The other values will be substituted at make time.
    CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
    if test "${SHARED_BUILD}" = "1" ; then
	CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
................................................................................


    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5
$as_echo_n "checking for tclsh... " >&6; }
    if test -f "${TCL_BIN_DIR}/Makefile" ; then
        # tclConfig.sh is in Tcl build directory
        if test "${TEA_PLATFORM}" = "windows"; then

            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"







        else
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
        fi
    else
        # tclConfig.sh is in install location
        if test "${TEA_PLATFORM}" = "windows"; then
            TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"







>













>
>
>
>
>
>







 







>







 







>
>







 







|





|

|


|
|
|







 







|







 







<

|







 







>

|


>
>







 







>
|
>
>

>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
<
<







 







|

|





|

|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|



>







>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>







 







|
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






|







 







|




|
|







 







|







 







>


>







 







|
|
<


|
>
>
|
|
|

|

|
|
<
|
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|





|








>
>
|
|
|
|
|
>
>







 







|
|







 







<
<
<







 







|











|
|
|







 







|
|
|
|







 







>







 







<







 







|







 







|







 







<



>
>
>
>
|

|
>
>
|
>

|













|


|


|







 







>

>
>
>
>
>
>
>







638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
...
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
....
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
....
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
....
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
....
2252
2253
2254
2255
2256
2257
2258

2259
2260
2261
2262
2263
2264
2265
2266
2267
....
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
....
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
....
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
....
5560
5561
5562
5563
5564
5565
5566
5567


5568
5569
5570
5571
5572
5573
5574
....
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
....
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
....
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
....
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
....
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
....
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
....
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
....
7325
7326
7327
7328
7329
7330
7331
7332
7333

7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346

7347





7348


































7349
7350
7351
7352
7353
7354
7355
....
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
....
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
....
8023
8024
8025
8026
8027
8028
8029



8030
8031
8032
8033
8034
8035
8036
....
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
....
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
....
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
....
8212
8213
8214
8215
8216
8217
8218

8219
8220
8221
8222
8223
8224
8225
....
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
....
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
....
8691
8692
8693
8694
8695
8696
8697

8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
....
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
STLIB_LD
CFLAGS_WARNING
CFLAGS_OPTIMIZE
CFLAGS_DEBUG
RC
CELIB_DIR
AR
STUBS_BUILD
SHARED_BUILD
TCL_THREADS
TCL_INCLUDES
PKG_OBJECTS
PKG_SOURCES
TDOM_SRC_DIR
TDOM_STUB_LIB_SPEC
TDOM_VERSION
MATH_LIBS
EGREP
GREP
RANLIB
SET_MAKE
INSTALL_LIBRARY
INSTALL_SCRIPT
INSTALL_PROGRAM
INSTALL_DATA
INSTALL_DATA_DIR
INSTALL
CPP
TCL_SHLIB_LD_LIBS
TCL_LD_FLAGS
TCL_EXTRA_CFLAGS
TCL_DEFS
TCL_LIBS
CLEANFILES
................................................................................
ac_user_opts='
enable_option_checking
with_tcl
with_tdom
with_tclinclude
enable_threads
enable_shared
enable_stubs
enable_64bit
enable_64bit_vis
enable_rpath
enable_wince
with_celib
enable_symbols
'
................................................................................

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-threads        build with threads
  --enable-shared         build and link with shared libraries (default: on)
  --enable-stubs          build and link with stub libraries. Always true for
                          shared builds (default: on)
  --enable-64bit          enable 64bit support (default: off)
  --enable-64bit-vis      enable 64bit Sparc VIS support (default: off)
  --disable-rpath         disable rpath support (default: on)
  --enable-wince          enable Win/CE support (where applicable)
  --enable-symbols        build with debugging symbols (default: off)

Optional Packages:
................................................................................
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------


    # TEA extensions pass this us the version of TEA they think they
    # are compatible with.
    TEA_VERSION="3.10"

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct TEA configuration" >&5
$as_echo_n "checking for correct TEA configuration... " >&6; }
    if test x"${PACKAGE_NAME}" = x ; then
	as_fn_error $? "
The PACKAGE_NAME variable must be defined by your TEA configure.ac" "$LINENO" 5
    fi
    if test x"3.10" = x ; then
	as_fn_error $? "
TEA version not specified." "$LINENO" 5
    elif test "3.10" != "${TEA_VERSION}" ; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"3.10\", have \"${TEA_VERSION}\"" >&5
$as_echo "warning: requested TEA version \"3.10\", have \"${TEA_VERSION}\"" >&6; }
    else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5
$as_echo "ok (TEA ${TEA_VERSION})" >&6; }
    fi

    # If the user did not set CFLAGS, set it now to keep macros
    # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2".
................................................................................
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    for ac_exec_ext in '' $ac_executable_extensions; do
  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CYGPATH="cygpath -m"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

................................................................................
fi


	    EXEEXT=".exe"
	    TEA_PLATFORM="windows"
	    ;;
	*CYGWIN_*)

	    EXEEXT=".exe"
	    # CYGPATH and TEA_PLATFORM are determined later in LOAD_TCLCONFIG
	    ;;
	*)
	    CYGPATH=echo
	    # Maybe we are cross-compiling....
	    case ${host_alias} in
		*mingw32*)
		EXEEXT=".exe"
................................................................................
	    fi

	    # check in a few common install locations
	    if test x"${ac_cv_c_tclconfig}" = x ; then
		for i in `ls -d ${libdir} 2>/dev/null` \
			`ls -d ${exec_prefix}/lib 2>/dev/null` \
			`ls -d ${prefix}/lib 2>/dev/null` \
			`ls -d /usr/contrib/lib 2>/dev/null` \
			`ls -d /usr/local/lib 2>/dev/null` \
			`ls -d /usr/pkg/lib 2>/dev/null` \
			`ls -d /usr/lib 2>/dev/null` \
			`ls -d /usr/lib64 2>/dev/null` \
			`ls -d /usr/lib/tcl8.6 2>/dev/null` \
			`ls -d /usr/lib/tcl8.5 2>/dev/null` \
			; do
		    if test -f "$i/tclConfig.sh" ; then
			ac_cv_c_tclconfig="`(cd $i; pwd)`"
			break
		    fi
		done
	    fi
................................................................................
	    #endif

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :

	    TEA_PLATFORM="unix"
	    CYGPATH=echo

else

	    TEA_PLATFORM="windows"
	    # Extract the first word of "cygpath", so it can be a program name with args.
set dummy cygpath; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CYGPATH+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$CYGPATH"; then
  ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    for ac_exec_ext in '' $ac_executable_extensions; do
  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CYGPATH="cygpath -m"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo"
fi
fi
CYGPATH=$ac_cv_prog_CYGPATH
if test -n "$CYGPATH"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGPATH" >&5
$as_echo "$CYGPATH" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    CC=$hold_cc
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEA_PLATFORM" >&5
$as_echo "$TEA_PLATFORM" >&6; }

................................................................................
fi

ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu


    INSTALL='$(SHELL) $(srcdir)/tclconfig/install-sh -c'
    INSTALL_DATA_DIR='${INSTALL} -d -m 755'
    INSTALL_DATA='${INSTALL} -m 644'
    INSTALL_PROGRAM='${INSTALL}'
    INSTALL_SCRIPT='${INSTALL}'
    INSTALL_LIBRARY='${INSTALL_DATA}'








    #--------------------------------------------------------------------
    # Checks to see if the make program sets the $MAKE variable.
    #--------------------------------------------------------------------

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
................................................................................
# You can add more files to clean if your extension creates any extra
# files.
#
# TEA_ADD_* any platform specific compiler/build info here.
#--------------------------------------------------------------------

if test "${TEA_PLATFORM}" = "windows" ; then
    #AC_DEFINE(BUILD_tnc, 1, [Build windows export dll])


    CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch"
    #TEA_ADD_SOURCES([win/winFile.c])
    #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
else
    CLEANFILES="pkgIndex.tcl"
    #TEA_ADD_SOURCES([unix/unixFile.c])
    #TEA_ADD_LIBS([-lsuperfly])
................................................................................
#--------------------------------------------------------------------


    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5
$as_echo_n "checking how to build libraries... " >&6; }
    # Check whether --enable-shared was given.
if test "${enable_shared+set}" = set; then :
  enableval=$enable_shared; shared_ok=$enableval
else
  shared_ok=yes
fi


    if test "${enable_shared+set}" = set; then
	enableval="$enable_shared"
	shared_ok=$enableval
    else
	shared_ok=yes
    fi

    # Check whether --enable-stubs was given.
if test "${enable_stubs+set}" = set; then :
  enableval=$enable_stubs; stubs_ok=$enableval
else
  stubs_ok=yes
fi


    if test "${enable_stubs+set}" = set; then
	enableval="$enable_stubs"
	stubs_ok=$enableval
    else
	stubs_ok=yes
    fi

    # Stubs are always enabled for shared builds
    if test "$shared_ok" = "yes" ; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: shared" >&5
$as_echo "shared" >&6; }
	SHARED_BUILD=1
        STUBS_BUILD=1
    else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5
$as_echo "static" >&6; }
	SHARED_BUILD=0

$as_echo "#define STATIC_BUILD 1" >>confdefs.h

        if test "$stubs_ok" = "yes" ; then
          STUBS_BUILD=1
        else
          STUBS_BUILD=0
        fi
    fi
    if test "${STUBS_BUILD}" = "1" ; then

$as_echo "#define USE_TCL_STUBS 1" >>confdefs.h


$as_echo "#define USE_TCLOO_STUBS 1" >>confdefs.h

      if test "${TEA_WINDOWINGSYSTEM}" != ""; then

$as_echo "#define USE_TK_STUBS 1" >>confdefs.h

      fi
    fi





#--------------------------------------------------------------------
# This macro figures out what flags to use with the compiler/linker
# when building shared/static debug/optimized objects.  This information
# can be taken from the tclConfig.sh file, but this figures it all out.
................................................................................
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_visibility_hidden" >&5
$as_echo "$tcl_cv_cc_visibility_hidden" >&6; }
    if test $tcl_cv_cc_visibility_hidden = yes; then :


$as_echo "#define MODULE_SCOPE extern __attribute__((__visibility__(\"hidden\")))" >>confdefs.h


$as_echo "#define HAVE_HIDDEN 1" >>confdefs.h


fi

    # Step 0.d: Disable -rpath support?

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if rpath support is requested" >&5
$as_echo_n "checking if rpath support is requested... " >&6; }
................................................................................
else
  AR="$ac_cv_prog_AR"
fi

    STLIB_LD='${AR} cr'
    LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
    if test "x$SHLIB_VERSION" = x; then :
  SHLIB_VERSION=""
else
  SHLIB_VERSION=".$SHLIB_VERSION"
fi
    case $system in
	# TEA specific:
	windows)
	    # This is a 2-stage check to make sure we have the 64-bit SDK
	    # We have to know where the SDK is installed.
	    # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
................................................................................

	    if test "$GCC" != "yes" ; then
	        if test "${SHARED_BUILD}" = "0" ; then
		    runtime=-MT
	        else
		    runtime=-MD
	        fi
	        case "x`echo \${VisualStudioVersion}`" in
	            x1[4-9]*)
		        lflags="${lflags} -nodefaultlib:libucrt.lib"

    vars="ucrt.lib"
    for i in $vars; do
	if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
	    # Convert foo.lib to -lfoo for GCC.  No-op if not *.lib
	    i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'`
	fi
	PKG_LIBS="$PKG_LIBS $i"
    done


	            ;;
	            *)
	            ;;
	        esac

                if test "$do64bit" != "no" ; then
		    # All this magic is necessary for the Win64 SDK RC1 - hobbs
		    CC="\"${PATH64}/cl.exe\""
		    CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
		    RC="\"${MSSDK}/bin/rc.exe\""
		    lflags="${lflags} -nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
		    LINKBIN="\"${PATH64}/link.exe\""
		    CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
		    # Avoid 'unresolved external symbol __security_cookie'
		    # errors, c.f. http://support.microsoft.com/?id=894573

    vars="bufferoverflowU.lib"
................................................................................
cat >>confdefs.h <<_ACEOF
#define UNDER_CE $CEVERSION
_ACEOF

		    CFLAGS_DEBUG="-nologo -Zi -Od"
		    CFLAGS_OPTIMIZE="-nologo -Ox"
		    lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
		    lflags="${lflags} -MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
		    LINKBIN="\"${CEBINROOT}/link.exe\""

		else
		    RC="rc"
		    lflags="${lflags} -nologo"
		    LINKBIN="link"
		    CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
		fi
	    fi

	    if test "$GCC" = "yes"; then
		# mingw gcc mode
................................................................................
$as_echo_n "checking for cross-compile version of gcc... " >&6; }
if ${ac_cv_cross+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

			    #ifdef _WIN32
				#error cross-compiler
			    #endif

int
main ()
{

................................................................................
	    LDFLAGS="$LDFLAGS -export-dynamic"
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
	    ;;
	CYGWIN_*)
	    SHLIB_CFLAGS=""
	    SHLIB_LD='${CC} -shared'
	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$@.a"
	    SHLIB_SUFFIX=".dll"
	    EXEEXT=".exe"
	    do64bit_ok=yes
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
	    ;;
	Haiku*)
	    LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
	    SHLIB_CFLAGS="-fPIC"
	    SHLIB_SUFFIX=".so"
................................................................................
		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
	    ;;
	OpenBSD-*)
	    arch=`arch -s`
	    case "$arch" in
	    alpha|sparc64)
		SHLIB_CFLAGS="-fPIC"

		;;
	    *)
		SHLIB_CFLAGS="-fpic"
		;;
	    esac
	    SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
	    SHLIB_SUFFIX=".so"
	    if test $doRpath = yes; then :

		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
	    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'

	    LDFLAGS="-Wl,-export-dynamic"





	    CFLAGS_OPTIMIZE="-O2"


































	    if test "${TCL_THREADS}" = "1"; then :

		# On OpenBSD:	Compile with -pthread
		#		Don't link with -lpthread
		LIBS=`echo $LIBS | sed s/-lpthread//`
		CFLAGS="$CFLAGS -pthread"

................................................................................

fi
	    ;;
	FreeBSD-*)
	    # This configuration from FreeBSD Ports.
	    SHLIB_CFLAGS="-fPIC"
	    SHLIB_LD="${CC} -shared"
	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$@"
	    SHLIB_SUFFIX=".so"
	    LDFLAGS=""
	    if test $doRpath = yes; then :

		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
	    if test "${TCL_THREADS}" = "1"; then :

		# The -pthread needs to go in the LDFLAGS, not LIBS
		LIBS=`echo $LIBS | sed s/-pthread//`
		CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
		LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
fi
	    case $system in
	    FreeBSD-3.*)
		# Version numbers are dot-stripped by system policy.
		TCL_TRIM_DOTS=`echo ${PACKAGE_VERSION} | tr -d .`
		UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1'
		TCL_LIB_VERSIONS_OK=nodots
		;;
	    esac
	    ;;
	Darwin-*)
	    CFLAGS_OPTIMIZE="-Os"
	    SHLIB_CFLAGS="-fno-common"
	    # To avoid discrepancies between what headers configure sees during
	    # preprocessing tests and compiling tests, move any -isysroot and
	    # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
................................................................................
	    if test "$GCC" = yes; then :

		SHLIB_CFLAGS="-fPIC -melf"
		LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"

else

		SHLIB_CFLAGS="-Kpic -belf"
		LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"

fi
	    SHLIB_LD="ld -G"
	    SHLIB_LD_LIBS=""
	    SHLIB_SUFFIX=".so"
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
................................................................................
fi

    if test "$tcl_cv_cc_visibility_hidden" != yes; then :


$as_echo "#define MODULE_SCOPE extern" >>confdefs.h





fi

    if test "$SHARED_LIB_SUFFIX" = ""; then :

    # TEA specific: use PACKAGE_VERSION instead of VERSION
    SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'
................................................................................
fi
    if test "$UNSHARED_LIB_SUFFIX" = ""; then :

    # TEA specific: use PACKAGE_VERSION instead of VERSION
    UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'
fi

    if test "${GCC}" = "yes" -a ${SHLIB_SUFFIX} = ".dll"; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SEH support in compiler" >&5
$as_echo_n "checking for SEH support in compiler... " >&6; }
if ${tcl_cv_seh+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  tcl_cv_seh=no
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN

	    int main(int argc, char** argv) {
		int a, b = 0;
		__try {
		    a = 666 / b;
		}
		__except (EXCEPTION_EXECUTE_HANDLER) {
................................................................................
$as_echo_n "checking for winnt.h that ignores VOID define... " >&6; }
if ${tcl_cv_winnt_ignore_void+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#define VOID void
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN

int
main ()
{

		CHAR c;
		SHORT s;
................................................................................
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_winnt_ignore_void" >&5
$as_echo "$tcl_cv_winnt_ignore_void" >&6; }
	if test "$tcl_cv_winnt_ignore_void" = "yes" ; then

$as_echo "#define HAVE_WINNT_IGNORE_VOID 1" >>confdefs.h

	fi
    fi

	# See if the compiler supports casting to a union type.
	# This is used to stop gcc from printing a compiler
	# warning when initializing a union member.

	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5
$as_echo_n "checking for cast to union support... " >&6; }
................................................................................
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5
$as_echo "$tcl_cv_cast_to_union" >&6; }
	if test "$tcl_cv_cast_to_union" = "yes"; then

$as_echo "#define HAVE_CAST_TO_UNION 1" >>confdefs.h

	fi








................................................................................
if ${tcl_cv_struct_dirent64+:} false; then :
  $as_echo_n "(cached) " >&6
else

	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <sys/types.h>
#include <dirent.h>
int
main ()
{
struct dirent64 p;
  ;
  return 0;
}
................................................................................

    CLEANFILES="$CLEANFILES *.manifest"


fi
rm -f conftest*

	MAKE_STUB_LIB="\${STLIB_LD} -nodefaultlib -out:\$@ \$(PKG_STUB_OBJECTS)"
    else
	MAKE_STATIC_LIB="\${STLIB_LD} \$@ \$(PKG_OBJECTS)"
	MAKE_SHARED_LIB="\${SHLIB_LD} -o \$@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
	MAKE_STUB_LIB="\${STLIB_LD} \$@ \$(PKG_STUB_OBJECTS)"
    fi

    if test "${SHARED_BUILD}" = "1" ; then
................................................................................
    # substituted. (@@@ Might not be necessary anymore)
    #--------------------------------------------------------------------

    if test "${TEA_PLATFORM}" = "windows" ; then
	if test "${SHARED_BUILD}" = "1" ; then
	    # We force the unresolved linking of symbols that are really in
	    # the private libraries of Tcl and Tk.

	    if test x"${TK_BIN_DIR}" != x ; then
		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
	    fi
	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
	    if test "$GCC" = "yes"; then
		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -static-libgcc"
	    fi
	    eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
	else
	    eval eval "PKG_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
	    if test "$GCC" = "yes"; then
		PKG_LIB_FILE=lib${PKG_LIB_FILE}
	    fi
	fi
	# Some packages build their own stubs libraries
	eval eval "PKG_STUB_LIB_FILE=${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
	if test "$GCC" = "yes"; then
	    PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
	fi
	# These aren't needed on Windows (either MSVC or gcc)
	RANLIB=:
	RANLIB_STUB=:
    else
	RANLIB_STUB="${RANLIB}"
	if test "${SHARED_BUILD}" = "1" ; then
	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
	    if test x"${TK_BIN_DIR}" != x ; then
		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
	    fi
	    eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
	    RANLIB=:
	else
	    eval eval "PKG_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
	fi
	# Some packages build their own stubs libraries
	eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_LIB_PREFIX}${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
    fi

    # These are escaped so that only CFLAGS is picked up at configure time.
    # The other values will be substituted at make time.
    CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
    if test "${SHARED_BUILD}" = "1" ; then
	CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
................................................................................


    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5
$as_echo_n "checking for tclsh... " >&6; }
    if test -f "${TCL_BIN_DIR}/Makefile" ; then
        # tclConfig.sh is in Tcl build directory
        if test "${TEA_PLATFORM}" = "windows"; then
          if test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
          elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}s${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}s${EXEEXT}"
          elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}t${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}t${EXEEXT}"
          elif test -f "${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}st${EXEEXT}" ; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}st${EXEEXT}"
          fi
        else
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
        fi
    else
        # tclConfig.sh is in install location
        if test "${TEA_PLATFORM}" = "windows"; then
            TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"

Changes to extensions/tnc/configure.in.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
..
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------

TEA_INIT([3.9])

AC_CONFIG_AUX_DIR(../../tclconfig)

#--------------------------------------------------------------------
# Load the tclConfig.sh file
#--------------------------------------------------------------------

................................................................................
# You can add more files to clean if your extension creates any extra
# files.
#
# TEA_ADD_* any platform specific compiler/build info here.
#--------------------------------------------------------------------

if test "${TEA_PLATFORM}" = "windows" ; then
    AC_DEFINE(BUILD_tnc, 1, [Build windows export dll])
    CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch"
    #TEA_ADD_SOURCES([win/winFile.c])
    #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
else
    CLEANFILES="pkgIndex.tcl"
    #TEA_ADD_SOURCES([unix/unixFile.c])
    #TEA_ADD_LIBS([-lsuperfly])







|







 







|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
..
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------

TEA_INIT([3.10])

AC_CONFIG_AUX_DIR(../../tclconfig)

#--------------------------------------------------------------------
# Load the tclConfig.sh file
#--------------------------------------------------------------------

................................................................................
# You can add more files to clean if your extension creates any extra
# files.
#
# TEA_ADD_* any platform specific compiler/build info here.
#--------------------------------------------------------------------

if test "${TEA_PLATFORM}" = "windows" ; then
    #AC_DEFINE(BUILD_tnc, 1, [Build windows export dll])
    CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch"
    #TEA_ADD_SOURCES([win/winFile.c])
    #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
else
    CLEANFILES="pkgIndex.tcl"
    #TEA_ADD_SOURCES([unix/unixFile.c])
    #TEA_ADD_LIBS([-lsuperfly])

Deleted extensions/tnc/makefile.vc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#----------------------------------------------------------------------------
#   This is derivated from the tcl8.3 win makefile and surely not
#   perfect. It works for me. 
#   rolf ade, 2001 (rolf@pointsman.de)
#   
#
#
#   Project directories
#
#   ROOT   = top of source tree
#
#   TOOLS32 = location of VC++ 32-bit development tools.
#
#   INSTALLDIR = where the install- targets should copy the binaries and
#                support files
#
#----------------------------------------------------------------------------

!if "$(MSVCDIR)" == ""
MSG = ^
You'll need to run vcvars32.bat from Developer Studio, first, to setup^
the environment.
!error $(MSG)
!endif


#          VC++ 2.0 header files are broken, so you need to use the
#          ones that come with the developer network CD's, or later
#          versions of VC++.
#
# INSTALLDIR = where the install- targets should copy the binaries and
#          support files
#

# Set this to the appropriate value of /MACHINE: for your platform
MACHINE                = IX86
ROOT           = ..\..
INSTALLDIR     = c:\Progra~1\Tcl

TOOLS32        = $(MSVCDIR)
TOOLS32_rc     = $(MSVCDIR)\..\common\MSDev98

# Uncomment the following line to compile with thread support
#THREADDEFINES = -DTCL_THREADS=1

# Set NODEBUG to 0 to compile with symbols
NODEBUG = 1

# The following defines can be used to control the amount of debugging
# code that is added to the compilation.
#
#      -DTCL_MEM_DEBUG         Enables the debugging memory allocator.
#      -DTCL_COMPILE_DEBUG     Enables byte compilation logging.
#      -DTCL_COMPILE_STATS     Enables byte compilation statistics gathering.
#      -DUSE_TCLALLOC=0        Disables the Tcl memory allocator in favor
#                              of the native malloc implementation.  This is
#
# DEBUGDEFINES = -DTCL_MEM_DEBUG -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
# DEBUGDEFINES = -DUSE_TCLALLOC=0


#-------------------------------------------------------------------------
#
#   Do not modify below this line
#
#-------------------------------------------------------------------------

NAMEPREFIX = libtnc
STUBPREFIX = $(NAMEPREFIX)stub
DOTVERSION = 0.3
PACKAGE_VERSION = \"0.3.0\"
VERSION = \"0.3\"
W32VERSION = 03
TDOMVER = 082

BINROOT         = .
!IF "$(NODEBUG)" == "1"
TMPDIRNAME      =
DBGX            =
!ELSE
TMPDIRNAME      = Debug
DBGX            = d
!ENDIF
TMPDIR          = $(BINROOT)
OUTDIRNAME      = $(TMPDIRNAME)
OUTDIR          = $(TMPDIR)
TOP_DIR         = $(BINROOT)\..

TNCLIB         = $(OUTDIR)\$(NAMEPREFIX)$(W32VERSION)$(DBGX).lib
TNCDLLNAME     = $(NAMEPREFIX)$(W32VERSION)$(DBGX).dll
TNCDLL         = $(OUTDIR)\$(TNCDLLNAME)

# MKDIR           = .\mkd.bat
RM              = del

LIB_INSTALL_DIR        = $(INSTALLDIR)\lib
BIN_INSTALL_DIR        = $(INSTALLDIR)\bin
SCRIPT_INSTALL_DIR     = $(INSTALLDIR)\lib\tcl$(DOTVERSION)
INCLUDE_INSTALL_DIR    = $(INSTALLDIR)\include


TNCOBJS = $(TMPDIR)\tnc.obj

cc32           = "$(TOOLS32)\bin\cl.exe"
link32         = "$(TOOLS32)\bin\link.exe"
rc32           = "$(TOOLS32_rc)\bin\rc.exe"
include32      = -I"$(TOOLS32)\include"
libpath32      = /LIBPATH:"$(TOOLS32)\lib"
tcllibpath     = /LIBPATH:"$(INSTALLDIR)\lib"
tdomlibpath    = /LIBPATH:"$(ROOT)\win\Release"
lib32          = "$(TOOLS32)\bin\lib.exe"

TNCDIR         = $(ROOT)\extensions\tnc
GENERICDIR     = $(ROOT)\generic
EXPATINCDIR    = $(ROOT)\expat
TCLINCDIR      = $(INSTALLDIR)\Include

TCL_INCLUDES   = -I"$(TNCDIR)" -I"$(GENERICDIR)" -I"$(EXPATINCDIR)" -I"$(TCLINCDIR)"
TCL_DEFINES    = $(DEBUGDEFINES) $(THREADDEFINES)

#-------------------------------------------------------------------------
#
#   Compile flags
#
#-------------------------------------------------------------------------

!IF "$(NODEBUG)" == "1"
# This cranks the optimization level to maximize speed
cdebug = -O2 -Gs -GD
!ELSE
!IF "$(MACHINE)" == "IA64"
cdebug = -Od -Zi
!ELSE
cdebug = -Z7 -Od
!ENDIF
!ENDIF

# declarations common to all compiler options
cflags = -c -nologo -Fp$(TMPDIR)\ -YX -DXML_DTD -DXML_NS -DUSE_TCL_STUBS -DUSE_TDOM_STUBS -DVERSION=$(VERSION) -DPACKAGE_VERSION=$(PACKAGE_VERSION)
cvarsdll = -MD$(DBGX)

TCL_CFLAGS     = $(cdebug) $(cflags) $(cvarsdll) $(include32) \
                       $(TCL_INCLUDES) $(TCL_DEFINES)
CON_CFLAGS     = $(cdebug) $(cflags) $(include32) -DCONSOLE

#-------------------------------------------------------------------------
#
#   Link flags
#
#-------------------------------------------------------------------------

!IF "$(NODEBUG)" == "1"
ldebug = /RELEASE
!ELSE
ldebug = -debug:full -debugtype:cv
!ENDIF

# declarations common to all linker options
lflags = /NODEFAULTLIB /NOLOGO /MACHINE:$(MACHINE) $(libpath32) $(tcllibpath) $(tdomlibpath) 

# declarations for use on Intel i386, i486, and Pentium systems
DLLENTRY = @12
dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll


conlflags = $(lflags) -subsystem:console -entry:mainCRTStartup
guilflags = $(lflags) -subsystem:windows -entry:WinMainCRTStartup

libc = libc$(DBGX).lib oldnames.lib
libcdll = msvcrt$(DBGX).lib oldnames.lib

baselibs   = kernel32.lib $(optlibs) advapi32.lib user32.lib tclstub84$(DBGX).lib tdomstub$(TDOMVER).lib 
winlibs     = $(baselibs) gdi32.lib comdlg32.lib winspool.lib


guilibs     = $(libc) $(winlibs)
conlibs     = $(libc) $(baselibs)
guilibsdll  = $(libcdll) $(winlibs)
conlibsdll  = $(libcdll) $(baselibs)

#-------------------------------------------------------------------------
#
#   Project specific targets
#
#-------------------------------------------------------------------------

release:   setup dlls
dlls:      setup $(TNCDLL)
all:       setup dlls $(CAT32)

setup:
#      @$(MKDIR) $(TMPDIR)
#      @$(MKDIR) $(OUTDIR)

$(TNCLIB): $(TNCDLL)

$(TNCDLL): $(TNCOBJS)
       $(link32) $(ldebug) $(dlllflags) \
               -out:$@ $(guilibsdll) @<<
$(TNCOBJS)
<<

#-------------------------------------------------------------------------
#   Implicit rules
#-------------------------------------------------------------------------

{$(TNCDIR)}.c{$(TMPDIR)}.obj:
    $(cc32) -DBUILD_tcl $(TCL_CFLAGS) -Fo$(TMPDIR)\ $<

clean:
       -@$(RM) $(OUTDIR)\*.exp 2>nul
       -@$(RM) $(OUTDIR)\*.lib 2>nul
       -@$(RM) $(OUTDIR)\*.dll 2>nul
       -@$(RM) $(TMPDIR)\*.pch 2>nul
       -@$(RM) $(TMPDIR)\*.obj 2>nul
       -@$(RM) $(TMPDIR)\*.ilk 2>nul
       -@$(RM) $(TMPDIR)\*.pdb 2>nul
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































































































































Changes to extensions/tnc/tests/loadtnc.tcl.

1
2
3
4
5
6
7
8
9
10
catch {load ../../../unix/libtdom0.8.4.so}
catch {load ../libtnc0.3.0.so}
catch {load ../../unix/libtdom0.8.4.so}
catch {load libtnc0.3.0.so}
# loadtnc.tcl --
#
# This file is [source]d by all.tcl and all test files, to ensure, that
# the tcltest package and the lastest tnc build is present.

if {[lsearch [namespace children] ::tcltest] == -1} {
|

|







1
2
3
4
5
6
7
8
9
10
catch {load ../../../unix/libtdom0.9.0.so}
catch {load ../libtnc0.3.0.so}
catch {load ../../unix/libtdom0.9.0.so}
catch {load libtnc0.3.0.so}
# loadtnc.tcl --
#
# This file is [source]d by all.tcl and all test files, to ensure, that
# the tcltest package and the lastest tnc build is present.

if {[lsearch [namespace children] ::tcltest] == -1} {

Changes to extensions/tnc/tests/tnc.test.

130
131
132
133
134
135
136













137
138
139
140
141
142
143
    <!ELEMENT b EMPTY>
]>
<!-- This not well-formed document doesn't have a root element -->}} errMsg]
    $parser free
    set result
} {1}














test tnc-3.1 {validate cmd} {
    set parser [expat]
    tnc $parser enable
    set result [catch {$parser parse $xml}]
    set validator [tnc $parser getValidateCmd]
    rename $validator {}
    $parser free







>
>
>
>
>
>
>
>
>
>
>
>
>







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
    <!ELEMENT b EMPTY>
]>
<!-- This not well-formed document doesn't have a root element -->}} errMsg]
    $parser free
    set result
} {1}

test tnc-2.7 {not valid document} {
    set parser [expat]
    tnc $parser enable
    set result [catch {$parser parse {<!DOCTYPE root [
    <!ELEMENT root (a,b)>
    <!ELEMENT a (#PCDATA)>
    <!ELEMENT b EMPTY>
]>
<root><a>text</a></root>}} errMsg]
    $parser free
    set errMsg
} {Validation error at line 6, character 17: Element can not end here (required element(s) missing).}

test tnc-3.1 {validate cmd} {
    set parser [expat]
    tnc $parser enable
    set result [catch {$parser parse $xml}]
    set validator [tnc $parser getValidateCmd]
    rename $validator {}
    $parser free

Changes to extensions/tnc/tnc.c.

2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
....
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
    Tcl_HashSearch search;

#ifdef TNC_DEBUG
    printf ("TncElementEndCommand start\n");
    printContentStack (tncdata);
#endif
    while (1) {
        if (!TncProbeElementEnd (tncdata, 0)) {
            signalNotValid (userData, TNC_ERROR_ELEMENT_CAN_NOT_END_HERE);
            return;
        }
        if (tncdata->contentStack[tncdata->contentStackPtr - 1].deep == 0) {
            break;
        }
        tncdata->contentStackPtr--;
................................................................................
    }
#endif
#ifdef USE_TDOM_STUBS
    if (Tdom_InitStubs(interp, "0.8", 0) == NULL) {
        return TCL_ERROR;
    }
#endif
    Tcl_PkgRequire (interp, "tdom", "0.8.0", 0);
    Tcl_CreateObjCommand (interp, "tnc", TclTncObjCmd, NULL, NULL );
    Tcl_PkgProvide (interp, "tnc", PACKAGE_VERSION);
    return TCL_OK;
}








|







 







|





2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
....
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
    Tcl_HashSearch search;

#ifdef TNC_DEBUG
    printf ("TncElementEndCommand start\n");
    printContentStack (tncdata);
#endif
    while (1) {
        if (!TncProbeElementEnd (tncdata)) {
            signalNotValid (userData, TNC_ERROR_ELEMENT_CAN_NOT_END_HERE);
            return;
        }
        if (tncdata->contentStack[tncdata->contentStackPtr - 1].deep == 0) {
            break;
        }
        tncdata->contentStackPtr--;
................................................................................
    }
#endif
#ifdef USE_TDOM_STUBS
    if (Tdom_InitStubs(interp, "0.8", 0) == NULL) {
        return TCL_ERROR;
    }
#endif
    Tcl_PkgRequire (interp, "tdom", NULL, 0);
    Tcl_CreateObjCommand (interp, "tnc", TclTncObjCmd, NULL, NULL );
    Tcl_PkgProvide (interp, "tnc", PACKAGE_VERSION);
    return TCL_OK;
}

Added extensions/tnc/win/makefile.vc.













































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
# makefile.vc --                                               -*- Makefile -*-
#
# Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+)
#
# This makefile is based upon the Tcl 8.4 Makefile.vc and modified to 
# make it suitable as a general package makefile. Look for the word EDIT
# which marks sections that may need modification. As a minumum you will
# need to change the PROJECT, DOTVERSION and DLLOBJS variables to values
# relevant to your package.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
# 
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-2000 Ajuba Solutions.
# Copyright (c) 2001 ActiveState Corporation.
# Copyright (c) 2001-2002 David Gravereaux.
# Copyright (c) 2003-2006 Pat Thoyts
#
#-------------------------------------------------------------------------
# RCS: @(#)$Id$
#-------------------------------------------------------------------------

# Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR)
# or with the MS Platform SDK (MSSDK). Visual Studio .NET 2003 and 2005 define
# VCINSTALLDIR instead. The MSVC Toolkit release defines yet another.
!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(MSSDK) && !defined(VCINSTALLDIR) && !defined(VCToolkitInstallDir)
MSG = ^
You need to run vcvars32.bat from Developer Studio or setenv.bat from the^
Platform SDK first to setup the environment.  Jump to this line to read^
the build instructions.
!error $(MSG)
!endif

#------------------------------------------------------------------------------
# HOW TO USE this makefile:
#
# 1)  It is now necessary to have %MSVCDir% set in the environment.  This is
#     used  as a check to see if vcvars32.bat had been run prior to running
#     nmake or during the installation of Microsoft Visual C++, MSVCDir had
#     been set globally and the PATH adjusted.  Either way is valid.
#
#     You'll need to run vcvars32.bat contained in the MsDev's vc(98)/bin
#     directory to setup the proper environment, if needed, for your current
#     setup.  This is a needed bootstrap requirement and allows the swapping of
#     different environments to be easier.
#
# 2)  To use the Platform SDK (not expressly needed), run setenv.bat after
#     vcvars32.bat according to the instructions for it.  This can also turn on
#     the 64-bit compiler, if your SDK has it.
#
# 3)  Targets are:
#	all       -- Builds everything.
#       <project> -- Builds the project (eg: nmake sample)
#	test      -- Builds and runs the test suite.
#	install   -- Installs the built binaries and libraries to $(INSTALLDIR)
#		     in an appropriate subdirectory.
#	clean/realclean/distclean -- varying levels of cleaning.
#
# 4)  Macros usable on the commandline:
#	INSTALLDIR=<path>
#		Sets where to install Tcl from the built binaries.
#		C:\Progra~1\Tcl is assumed when not specified.
#
#	OPTS=static,msvcrt,staticpkg,threads,symbols,profile,loimpact,none
#		Sets special options for the core.  The default is for none.
#		Any combination of the above may be used (comma separated).
#		'none' will over-ride everything to nothing.
#
#		static  =  Builds a static library of the core instead of a
#			   dll.  The shell will be static (and large), as well.
#		msvcrt  =  Effects the static option only to switch it from
#			   using libcmt(d) as the C runtime [by default] to
#			   msvcrt(d). This is useful for static embedding
#			   support.
#		staticpkg = Effects the static option only to switch
#			   tclshXX.exe to have the dde and reg extension linked
#			   inside it.
#		nothreads = Turns off multithreading support (not recommended)
#		thrdalloc = Use the thread allocator (shared global free pool).
#		symbols =  Adds symbols for step debugging.
#		profile =  Adds profiling hooks.  Map file is assumed.
#		loimpact =  Adds a flag for how NT treats the heap to keep memory
#			   in use, low.  This is said to impact alloc performance.
#
#	STATS=memdbg,compdbg,none
#		Sets optional memory and bytecode compiler debugging code added
#		to the core.  The default is for none.  Any combination of the
#		above may be used (comma separated).  'none' will over-ride
#		everything to nothing.
#
#		memdbg   = Enables the debugging memory allocator.
#		compdbg  = Enables byte compilation logging.
#
#	MACHINE=(IX86|IA64|ALPHA|AMD64)
#		Set the machine type used for the compiler, linker, and
#		resource compiler.  This hook is needed to tell the tools
#		when alternate platforms are requested.  IX86 is the default
#		when not specified. If the CPU environment variable has been
#		set (ie: recent Platform SDK) then MACHINE is set from CPU.
#
#	TMP_DIR=<path>
#	OUT_DIR=<path>
#		Hooks to allow the intermediate and output directories to be
#		changed.  $(OUT_DIR) is assumed to be 
#		$(BINROOT)\(Release|Debug) based on if symbols are requested.
#		$(TMP_DIR) will de $(OUT_DIR)\<buildtype> by default.
#
#	TESTPAT=<file>
#		Reads the tests requested to be run from this file.
#
#	CFG_ENCODING=encoding
#		name of encoding for configuration information. Defaults
#		to cp1252
#
# 5)  Examples:
#
#	Basic syntax of calling nmake looks like this:
#	nmake [-nologo] -f makefile.vc [target|macrodef [target|macrodef] [...]]
#
#                        Standard (no frills)
#       c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
#       Setting environment for using Microsoft Visual C++ tools.
#       c:\tcl_src\win\>nmake -f makefile.vc all
#       c:\tcl_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl
#
#                         Building for Win64
#       c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
#       Setting environment for using Microsoft Visual C++ tools.
#       c:\tcl_src\win\>c:\progra~1\platfo~1\setenv.bat /pre64 /RETAIL
#       Targeting Windows pre64 RETAIL
#       c:\tcl_src\win\>nmake -f makefile.vc MACHINE=IA64
#
#------------------------------------------------------------------------------
#==============================================================================
###############################################################################
#------------------------------------------------------------------------------

!if !exist("makefile.vc")
MSG = ^
You must run this makefile only from the directory it is in.^
Please `cd` to its location first.
!error $(MSG)
!endif

#-------------------------------------------------------------------------
# Project specific information (EDIT)
#
# You should edit this with the name and version of your project. This
# information is used to generate the name of the package library and
# it's install location.
#
# For example, the sample extension is  going to build sample04.dll and
# would install it into $(INSTALLDIR)\lib\sample04
#
# You need to specify the object files that need to be linked into your
# binary here.
#
#-------------------------------------------------------------------------

PROJECT = tnc
!include "..\..\..\win\rules.vc"

DOTVERSION      = 0.3.0
VERSION         = $(DOTVERSION:.=)
STUBPREFIX      = $(PROJECT)stub

DLLOBJS = $(TMP_DIR)\tnc.obj

TDOM_DOTVERSION      = 0.8.3
TDOMVER             = $(TDOM_DOTVERSION:.=)

BINROOT		= .
# tdom root
ROOT            = ..\..\..

PRJIMPLIB	= $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
PRJLIBNAME	= $(PROJECT)$(VERSION)$(SUFX).$(EXT)
PRJLIB		= $(OUT_DIR)\$(PRJLIBNAME)

### Make sure we use backslash only.
PRJ_INSTALL_DIR         = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION)
LIB_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
BIN_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
DOC_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
SCRIPT_INSTALL_DIR	= $(PRJ_INSTALL_DIR)
INCLUDE_INSTALL_DIR	= $(_TCLDIR)\include

#---------------------------------------------------------------------
# Compile flags
#---------------------------------------------------------------------

!if !$(DEBUG)
!if $(OPTIMIZING)
### This cranks the optimization level to maximize speed
cdebug	= $(OPTIMIZATIONS)
!else
cdebug	=
!endif
!else if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
### Warnings are too many, can't support warnings into errors.
cdebug	= -Zi -Od $(DEBUGFLAGS)
!else
cdebug	= -Zi -WX $(DEBUGFLAGS)
!endif

### Declarations common to all compiler options
cwarn = -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE
cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\

!if $(MSVCRT)
!if $(DEBUG) && !$(UNCHECKED)
crt = -MDd
!else
crt = -MD
!endif
!else
!if $(DEBUG) && !$(UNCHECKED)
crt = -MTd
!else
crt = -MT
!endif
!endif

!if !$(STATIC_BUILD)
cflags = $(cflags) -DUSE_TCL_STUBS -DUSE_TDOM_STUBS
!if defined(TKSTUBLIB)
cflags = $(cflags) -DUSE_TK_STUBS
!endif
!endif

TDOMLIBPATH    = "$(ROOT)\win\$(BUILDDIRTOP)"

TNCDIR         = $(ROOT)\extensions\tnc
WINDIR		= $(TNCDIR)\win
GENERICDIR     = $(ROOT)\generic
EXPATDIR    = $(ROOT)\expat
TCLINCDIR      = $(INSTALLDIR)\Include

DEFS            = -DHAVE_MEMMOVE=1 -DXML_DTD=1 -DXML_NS=1 -DTDOM_NO_UNKNOWN_CMD=1
INCLUDES	= -I"$(WINDIR)" -I"$(TNCDIR)" -I"$(GENERICDIR)" -I"$(EXPATDIR)" $(TCL_INCLUDES)
BASE_CFLAGS	= $(cflags) $(cdebug) $(crt) $(INCLUDES)
CON_CFLAGS	= $(cflags) $(cdebug) $(crt) -DCONSOLE
TCL_CFLAGS      = -DPACKAGE_NAME="\"$(PROJECT)\"" \
		  -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \
		  -DTDOM_PACKAGE_VERSION="\"$(TDOM_DOTVERSION)\"" \
		  $(BASE_CFLAGS) $(OPTDEFINES) $(DEFS) $(DEFS_EXPAT)


#---------------------------------------------------------------------
# Link flags
#---------------------------------------------------------------------

!if $(DEBUG)
ldebug	= -debug:full -debugtype:cv
!if $(MSVCRT)
ldebug = $(ldebug) -nodefaultlib:msvcrt
!endif
!else
ldebug	= -release -opt:ref -opt:icf,3
!endif

### Declarations common to all linker options
lflags	= -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)

!if $(PROFILE)
lflags	= $(lflags) -profile
!endif

!if $(ALIGN98_HACK) && !$(STATIC_BUILD)
### Align sections for PE size savings.
lflags	= $(lflags) -opt:nowin98
!else if !$(ALIGN98_HACK) && $(STATIC_BUILD)
### Align sections for speed in loading by choosing the virtual page size.
lflags	= $(lflags) -align:4096
!endif

!if $(LOIMPACT)
lflags	= $(lflags) -ws:aggressive
!endif

dlllflags = $(lflags) -dll
conlflags = $(lflags) -subsystem:console
guilflags = $(lflags) -subsystem:windows
!if !$(STATIC_BUILD)
baselibs  = $(TCLSTUBLIB) $(TDOMLIBPATH)\tdomstub$(TDOMVER).lib
!if defined(TKSTUBLIB)
baselibs  = $(baselibs) $(TKSTUBLIB)
!endif
!endif

# Avoid 'unresolved external symbol __security_cookie' errors.
# c.f. http://support.microsoft.com/?id=894573
!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
baselibs   = $(baselibs) bufferoverflowU.lib
!endif

#---------------------------------------------------------------------
# TclTest flags
#---------------------------------------------------------------------

!IF "$(TESTPAT)" != ""
TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
!ENDIF

#---------------------------------------------------------------------
# Project specific targets (EDIT)
#---------------------------------------------------------------------

all:	    setup $(PROJECT)
$(PROJECT): setup $(PRJLIB)
install:    install-binaries install-libraries install-docs

# Tests need to ensure we load the right dll file we
# have to handle the output differently on Win9x.
#
!if "$(OS)" == "Windows_NT"  || "$(MSVCDIR)" == "IDE"
test: setup $(PROJECT)
        set TCL_LIBRARY=$(ROOT)/library
        $(TCLSH) <<
load $(PRJLIB:\=/)
source [file join $(LIBDIR:\=/) tdom.tcl]
cd "$(ROOT)/tests"
set argv "$(TESTFLAGS)"
source all.tcl
<<
!else
test: setup $(PROJECT)
        echo Please wait while the test results are collected
        set TCL_LIBRARY=$(ROOT)/library
        $(TCLSH) << >tests.log
load $(PRJLIB:\=/)
source [file join $(LIBDIR:\=/) tdom.tcl]
cd "$(ROOT)/tests"
set argv "$(TESTFLAGS)"
source all.tcl
<<
        type tests.log | more
!endif

setup:
	@if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR)
	@if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR)

# See <tcl>/win/coffbase.txt for extension base addresses.
$(PRJLIB): $(DLLOBJS)
!if $(STATIC_BUILD)
	$(lib32) -nologo -out:$@ @<<
$**
<<
!else
	$(link32) $(dlllflags)  -out:$@ $(baselibs) @<<
$**
<<
	$(_VC_MANIFEST_EMBED_DLL)
	-@del $*.exp
!endif

#---------------------------------------------------------------------
# Implicit rules
#---------------------------------------------------------------------

{$(WINDIR)}.c{$(TMP_DIR)}.obj::
    $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
$<
<<

{$(TNCDIR)}.c{$(TMP_DIR)}.obj::
    $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
$<
<<

{$(WINDIR)}.rc{$(TMP_DIR)}.res:
	$(rc32) -fo $@ -r -i "$(GENERICDIR)" -D__WIN32__ \
                -DCOMMAVERSION=$(DOTVERSION:.=,),0 \
                -DDOTVERSION=\"$(DOTVERSION)\" \
                -DVERSION=\"$(VERSION)$(SUFX)\" \
!if $(DEBUG)
	-d DEBUG \
!endif
!if $(TCL_THREADS)
	-d TCL_THREADS \
!endif
!if $(STATIC_BUILD)
	-d STATIC_BUILD \
!endif
	$<

.SUFFIXES:
.SUFFIXES:.c .rc

#-------------------------------------------------------------------------
# Explicit dependency rules
#
#-------------------------------------------------------------------------


#---------------------------------------------------------------------
# Installation. (EDIT)
#
# You may need to modify this section to reflect the final distribution
# of your files and possibly to generate documentation.
#
#---------------------------------------------------------------------

install-binaries:
	@echo Installing binaries to '$(SCRIPT_INSTALL_DIR)'
	@if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)"
	@$(CPY) $(PRJLIB) "$(SCRIPT_INSTALL_DIR)" >NUL
	@$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" >NUL

install-libraries:
        @echo Installing package index in '$(SCRIPT_INSTALL_DIR)'
        @type << >"$(SCRIPT_INSTALL_DIR)\pkgIndex.tcl"
    package ifneeded $(PROJECT) $(DOTVERSION) "[list load [file join $$dir $(PROJECT)$(VERSION)$(SUFX).$(EXT)] $(PROJECT)]"
<<

install-docs:
#	@echo Installing documentation files to '$(DOC_INSTALL_DIR)'
#	@if exist $(DOCDIR) $(CPY) $(DOCDIR)\*.n "$(DOC_INSTALL_DIR)"

#---------------------------------------------------------------------
# Clean up
#---------------------------------------------------------------------

clean:
	@if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
	@if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc
	@if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i
	@if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x
	@if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch

realclean: clean
	@if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR)

distclean: realclean
	@if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
	@if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj

Added extensions/tnc/win/nmakehlp.c.



































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
/*
 * ----------------------------------------------------------------------------
 * nmakehlp.c --
 *
 *	This is used to fix limitations within nmake and the environment.
 *
 * Copyright (c) 2002 by David Gravereaux.
 * Copyright (c) 2006 by Pat Thoyts
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * ----------------------------------------------------------------------------
 */

#define _CRT_SECURE_NO_DEPRECATE
#include <windows.h>
#define NO_SHLWAPI_GDI
#define NO_SHLWAPI_STREAM
#define NO_SHLWAPI_REG
#include <shlwapi.h>
#pragma comment (lib, "user32.lib")
#pragma comment (lib, "kernel32.lib")
#pragma comment (lib, "shlwapi.lib")
#include <stdio.h>
#include <math.h>

/*
 * This library is required for x64 builds with _some_ versions of MSVC
 */
#if defined(_M_IA64) || defined(_M_AMD64)
#if _MSC_VER >= 1400 && _MSC_VER < 1500
#pragma comment(lib, "bufferoverflowU")
#endif
#endif

/* ISO hack for dumb VC++ */
#ifdef _MSC_VER
#define   snprintf	_snprintf
#endif



/* protos */

static int CheckForCompilerFeature(const char *option);
static int CheckForLinkerFeature(const char **options, int count);
static int IsIn(const char *string, const char *substring);
static int SubstituteFile(const char *substs, const char *filename);
static int QualifyPath(const char *path);
static const char *GetVersionFromFile(const char *filename, const char *match, int numdots);
static DWORD WINAPI ReadFromPipe(LPVOID args);

/* globals */

#define CHUNK	25
#define STATICBUFFERSIZE    1000
typedef struct {
    HANDLE pipe;
    char buffer[STATICBUFFERSIZE];
} pipeinfo;

pipeinfo Out = {INVALID_HANDLE_VALUE, '\0'};
pipeinfo Err = {INVALID_HANDLE_VALUE, '\0'};
 
/*
 * exitcodes: 0 == no, 1 == yes, 2 == error
 */

int
main(
    int argc,
    char *argv[])
{
    char msg[300];
    DWORD dwWritten;
    int chars;

    /*
     * Make sure children (cl.exe and link.exe) are kept quiet.
     */

    SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);

    /*
     * Make sure the compiler and linker aren't effected by the outside world.
     */

    SetEnvironmentVariable("CL", "");
    SetEnvironmentVariable("LINK", "");

    if (argc > 1 && *argv[1] == '-') {
	switch (*(argv[1]+1)) {
	case 'c':
	    if (argc != 3) {
		chars = snprintf(msg, sizeof(msg) - 1,
		        "usage: %s -c <compiler option>\n"
			"Tests for whether cl.exe supports an option\n"
			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
			&dwWritten, NULL);
		return 2;
	    }
	    return CheckForCompilerFeature(argv[2]);
	case 'l':
	    if (argc < 3) {
		chars = snprintf(msg, sizeof(msg) - 1,
	       		"usage: %s -l <linker option> ?<mandatory option> ...?\n"
			"Tests for whether link.exe supports an option\n"
			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
			&dwWritten, NULL);
		return 2;
	    }
	    return CheckForLinkerFeature(&argv[2], argc-2);
	case 'f':
	    if (argc == 2) {
		chars = snprintf(msg, sizeof(msg) - 1,
			"usage: %s -f <string> <substring>\n"
			"Find a substring within another\n"
			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
			&dwWritten, NULL);
		return 2;
	    } else if (argc == 3) {
		/*
		 * If the string is blank, there is no match.
		 */

		return 0;
	    } else {
		return IsIn(argv[2], argv[3]);
	    }
	case 's':
	    if (argc == 2) {
		chars = snprintf(msg, sizeof(msg) - 1,
			"usage: %s -s <substitutions file> <file>\n"
			"Perform a set of string map type substutitions on a file\n"
			"exitcodes: 0\n",
			argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
			&dwWritten, NULL);
		return 2;
	    }
	    return SubstituteFile(argv[2], argv[3]);
	case 'V':
	    if (argc != 4) {
		chars = snprintf(msg, sizeof(msg) - 1,
		    "usage: %s -V filename matchstring\n"
		    "Extract a version from a file:\n"
		    "eg: pkgIndex.tcl \"package ifneeded http\"",
		    argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
		    &dwWritten, NULL);
		return 0;
	    }
	    printf("%s\n", GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0'));
	    return 0;
	case 'Q':
	    if (argc != 3) {
		chars = snprintf(msg, sizeof(msg) - 1,
		    "usage: %s -Q path\n"
		    "Emit the fully qualified path\n"
		    "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
		    &dwWritten, NULL);
		return 2;
	    }
	    return QualifyPath(argv[2]);
	}
    }
    chars = snprintf(msg, sizeof(msg) - 1,
	    "usage: %s -c|-f|-l|-Q|-s|-V ...\n"
	    "This is a little helper app to equalize shell differences between WinNT and\n"
	    "Win9x and get nmake.exe to accomplish its job.\n",
	    argv[0]);
    WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
    return 2;
}
 
static int
CheckForCompilerFeature(
    const char *option)
{
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
    SECURITY_ATTRIBUTES sa;
    DWORD threadID;
    char msg[300];
    BOOL ok;
    HANDLE hProcess, h, pipeThreads[2];
    char cmdline[100];

    hProcess = GetCurrentProcess();

    ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
    ZeroMemory(&si, sizeof(STARTUPINFO));
    si.cb = sizeof(STARTUPINFO);
    si.dwFlags   = STARTF_USESTDHANDLES;
    si.hStdInput = INVALID_HANDLE_VALUE;

    ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
    sa.lpSecurityDescriptor = NULL;
    sa.bInheritHandle = FALSE;

    /*
     * Create a non-inheritible pipe.
     */

    CreatePipe(&Out.pipe, &h, &sa, 0);

    /*
     * Dupe the write side, make it inheritible, and close the original.
     */

    DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE,
	    DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);

    /*
     * Same as above, but for the error side.
     */

    CreatePipe(&Err.pipe, &h, &sa, 0);
    DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE,
	    DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);

    /*
     * Base command line.
     */

    lstrcpy(cmdline, "cl.exe -nologo -c -TC -Zs -X -Fp.\\_junk.pch ");

    /*
     * Append our option for testing
     */

    lstrcat(cmdline, option);

    /*
     * Filename to compile, which exists, but is nothing and empty.
     */

    lstrcat(cmdline, " .\\nul");

    ok = CreateProcess(
	    NULL,	    /* Module name. */
	    cmdline,	    /* Command line. */
	    NULL,	    /* Process handle not inheritable. */
	    NULL,	    /* Thread handle not inheritable. */
	    TRUE,	    /* yes, inherit handles. */
	    DETACHED_PROCESS, /* No console for you. */
	    NULL,	    /* Use parent's environment block. */
	    NULL,	    /* Use parent's starting directory. */
	    &si,	    /* Pointer to STARTUPINFO structure. */
	    &pi);	    /* Pointer to PROCESS_INFORMATION structure. */

    if (!ok) {
	DWORD err = GetLastError();
	int chars = snprintf(msg, sizeof(msg) - 1,
		"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);

	FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
		FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
		(300-chars), 0);
	WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL);
	return 2;
    }

    /*
     * Close our references to the write handles that have now been inherited.
     */

    CloseHandle(si.hStdOutput);
    CloseHandle(si.hStdError);

    WaitForInputIdle(pi.hProcess, 5000);
    CloseHandle(pi.hThread);

    /*
     * Start the pipe reader threads.
     */

    pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID);
    pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID);

    /*
     * Block waiting for the process to end.
     */

    WaitForSingleObject(pi.hProcess, INFINITE);
    CloseHandle(pi.hProcess);

    /*
     * Wait for our pipe to get done reading, should it be a little slow.
     */

    WaitForMultipleObjects(2, pipeThreads, TRUE, 500);
    CloseHandle(pipeThreads[0]);
    CloseHandle(pipeThreads[1]);

    /*
     * Look for the commandline warning code in both streams.
     *  - in MSVC 6 & 7 we get D4002, in MSVC 8 we get D9002.
     */

    return !(strstr(Out.buffer, "D4002") != NULL
             || strstr(Err.buffer, "D4002") != NULL
             || strstr(Out.buffer, "D9002") != NULL
             || strstr(Err.buffer, "D9002") != NULL
             || strstr(Out.buffer, "D2021") != NULL
             || strstr(Err.buffer, "D2021") != NULL);
}
 
static int
CheckForLinkerFeature(
    const char **options,
    int count)
{
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
    SECURITY_ATTRIBUTES sa;
    DWORD threadID;
    char msg[300];
    BOOL ok;
    HANDLE hProcess, h, pipeThreads[2];
    int i;
    char cmdline[255];

    hProcess = GetCurrentProcess();

    ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
    ZeroMemory(&si, sizeof(STARTUPINFO));
    si.cb = sizeof(STARTUPINFO);
    si.dwFlags   = STARTF_USESTDHANDLES;
    si.hStdInput = INVALID_HANDLE_VALUE;

    ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
    sa.lpSecurityDescriptor = NULL;
    sa.bInheritHandle = TRUE;

    /*
     * Create a non-inheritible pipe.
     */

    CreatePipe(&Out.pipe, &h, &sa, 0);

    /*
     * Dupe the write side, make it inheritible, and close the original.
     */

    DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE,
	    DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);

    /*
     * Same as above, but for the error side.
     */

    CreatePipe(&Err.pipe, &h, &sa, 0);
    DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE,
	    DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);

    /*
     * Base command line.
     */

    lstrcpy(cmdline, "link.exe -nologo ");

    /*
     * Append our option for testing.
     */

    for (i = 0; i < count; i++) {
	lstrcat(cmdline, " \"");
	lstrcat(cmdline, options[i]);
	lstrcat(cmdline, "\"");
    }

    ok = CreateProcess(
	    NULL,	    /* Module name. */
	    cmdline,	    /* Command line. */
	    NULL,	    /* Process handle not inheritable. */
	    NULL,	    /* Thread handle not inheritable. */
	    TRUE,	    /* yes, inherit handles. */
	    DETACHED_PROCESS, /* No console for you. */
	    NULL,	    /* Use parent's environment block. */
	    NULL,	    /* Use parent's starting directory. */
	    &si,	    /* Pointer to STARTUPINFO structure. */
	    &pi);	    /* Pointer to PROCESS_INFORMATION structure. */

    if (!ok) {
	DWORD err = GetLastError();
	int chars = snprintf(msg, sizeof(msg) - 1,
		"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);

	FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
		FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
		(300-chars), 0);
	WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL);
	return 2;
    }

    /*
     * Close our references to the write handles that have now been inherited.
     */

    CloseHandle(si.hStdOutput);
    CloseHandle(si.hStdError);

    WaitForInputIdle(pi.hProcess, 5000);
    CloseHandle(pi.hThread);

    /*
     * Start the pipe reader threads.
     */

    pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID);
    pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID);

    /*
     * Block waiting for the process to end.
     */

    WaitForSingleObject(pi.hProcess, INFINITE);
    CloseHandle(pi.hProcess);

    /*
     * Wait for our pipe to get done reading, should it be a little slow.
     */

    WaitForMultipleObjects(2, pipeThreads, TRUE, 500);
    CloseHandle(pipeThreads[0]);
    CloseHandle(pipeThreads[1]);

    /*
     * Look for the commandline warning code in the stderr stream.
     */

    return !(strstr(Out.buffer, "LNK1117") != NULL ||
	    strstr(Err.buffer, "LNK1117") != NULL ||
	    strstr(Out.buffer, "LNK4044") != NULL ||
	    strstr(Err.buffer, "LNK4044") != NULL ||
	    strstr(Out.buffer, "LNK4224") != NULL ||
	    strstr(Err.buffer, "LNK4224") != NULL);
}
 
static DWORD WINAPI
ReadFromPipe(
    LPVOID args)
{
    pipeinfo *pi = (pipeinfo *) args;
    char *lastBuf = pi->buffer;
    DWORD dwRead;
    BOOL ok;

  again:
    if (lastBuf - pi->buffer + CHUNK > STATICBUFFERSIZE) {
	CloseHandle(pi->pipe);
	return (DWORD)-1;
    }
    ok = ReadFile(pi->pipe, lastBuf, CHUNK, &dwRead, 0L);
    if (!ok || dwRead == 0) {
	CloseHandle(pi->pipe);
	return 0;
    }
    lastBuf += dwRead;
    goto again;

    return 0;  /* makes the compiler happy */
}
 
static int
IsIn(
    const char *string,
    const char *substring)
{
    return (strstr(string, substring) != NULL);
}
 
/*
 * GetVersionFromFile --
 * 	Looks for a match string in a file and then returns the version
 * 	following the match where a version is anything acceptable to
 * 	package provide or package ifneeded.
 */

static const char *
GetVersionFromFile(
    const char *filename,
    const char *match,
    int numdots)
{
    size_t cbBuffer = 100;
    static char szBuffer[100];
    char *szResult = NULL;
    FILE *fp = fopen(filename, "rt");

    if (fp != NULL) {
	/*
	 * Read data until we see our match string.
	 */

	while (fgets(szBuffer, cbBuffer, fp) != NULL) {
	    LPSTR p, q;

	    p = strstr(szBuffer, match);
	    if (p != NULL) {
		/*
		 * Skip to first digit after the match.
		 */

		p += strlen(match);
		while (*p && !isdigit(*p)) {
		    ++p;
		}

		/*
		 * Find ending whitespace.
		 */

		q = p;
		while (*q && (strchr("0123456789.ab", *q)) && ((!strchr(".ab", *q)
			    && (!strchr("ab", q[-1])) || --numdots))) {
		    ++q;
		}

		memcpy(szBuffer, p, q - p);
		szBuffer[q-p] = 0;
		szResult = szBuffer;
		break;
	    }
	}
	fclose(fp);
    }
    return szResult;
}
 
/*
 * List helpers for the SubstituteFile function
 */

typedef struct list_item_t {
    struct list_item_t *nextPtr;
    char * key;
    char * value;
} list_item_t;

/* insert a list item into the list (list may be null) */
static list_item_t *
list_insert(list_item_t **listPtrPtr, const char *key, const char *value)
{
    list_item_t *itemPtr = malloc(sizeof(list_item_t));
    if (itemPtr) {
	itemPtr->key = strdup(key);
	itemPtr->value = strdup(value);
	itemPtr->nextPtr = NULL;

	while(*listPtrPtr) {
	    listPtrPtr = &(*listPtrPtr)->nextPtr;
	}
	*listPtrPtr = itemPtr;
    }
    return itemPtr;
}

static void
list_free(list_item_t **listPtrPtr)
{
    list_item_t *tmpPtr, *listPtr = *listPtrPtr;
    while (listPtr) {
	tmpPtr = listPtr;
	listPtr = listPtr->nextPtr;
	free(tmpPtr->key);
	free(tmpPtr->value);
	free(tmpPtr);
    }
}
 
/*
 * SubstituteFile --
 *	As windows doesn't provide anything useful like sed and it's unreliable
 *	to use the tclsh you are building against (consider x-platform builds -
 *	eg compiling AMD64 target from IX86) we provide a simple substitution
 *	option here to handle autoconf style substitutions.
 *	The substitution file is whitespace and line delimited. The file should
 *	consist of lines matching the regular expression:
 *	  \s*\S+\s+\S*$
 *
 *	Usage is something like:
 *	  nmakehlp -S << $** > $@
 *        @PACKAGE_NAME@ $(PACKAGE_NAME)
 *        @PACKAGE_VERSION@ $(PACKAGE_VERSION)
 *        <<
 */

static int
SubstituteFile(
    const char *substitutions,
    const char *filename)
{
    size_t cbBuffer = 1024;
    static char szBuffer[1024], szCopy[1024];
    char *szResult = NULL;
    list_item_t *substPtr = NULL;
    FILE *fp, *sp;

    fp = fopen(filename, "rt");
    if (fp != NULL) {

	/*
	 * Build a list of substutitions from the first filename
	 */

	sp = fopen(substitutions, "rt");
	if (sp != NULL) {
	    while (fgets(szBuffer, cbBuffer, sp) != NULL) {
		unsigned char *ks, *ke, *vs, *ve;
		ks = (unsigned char*)szBuffer;
		while (ks && *ks && isspace(*ks)) ++ks;
		ke = ks;
		while (ke && *ke && !isspace(*ke)) ++ke;
		vs = ke;
		while (vs && *vs && isspace(*vs)) ++vs;
		ve = vs;
		while (ve && *ve && !(*ve == '\r' || *ve == '\n')) ++ve;
		*ke = 0, *ve = 0;
		list_insert(&substPtr, (char*)ks, (char*)vs);
	    }
	    fclose(sp);
	}

	/* debug: dump the list */
#ifdef _DEBUG
	{
	    int n = 0;
	    list_item_t *p = NULL;
	    for (p = substPtr; p != NULL; p = p->nextPtr, ++n) {
		fprintf(stderr, "% 3d '%s' => '%s'\n", n, p->key, p->value);
	    }
	}
#endif

	/*
	 * Run the substitutions over each line of the input
	 */

	while (fgets(szBuffer, cbBuffer, fp) != NULL) {
	    list_item_t *p = NULL;
	    for (p = substPtr; p != NULL; p = p->nextPtr) {
		char *m = strstr(szBuffer, p->key);
		if (m) {
		    char *cp, *op, *sp;
		    cp = szCopy;
		    op = szBuffer;
		    while (op != m) *cp++ = *op++;
		    sp = p->value;
		    while (sp && *sp) *cp++ = *sp++;
		    op += strlen(p->key);
		    while (*op) *cp++ = *op++;
		    *cp = 0;
		    memcpy(szBuffer, szCopy, sizeof(szCopy));
		}
	    }
	    printf(szBuffer);
	}

	list_free(&substPtr);
    }
    fclose(fp);
    return 0;
}
 
/*
 * QualifyPath --
 *
 *	This composes the current working directory with a provided path
 *	and returns the fully qualified and normalized path.
 *	Mostly needed to setup paths for testing.
 */

static int
QualifyPath(
    const char *szPath)
{
    char szCwd[MAX_PATH + 1];
    char szTmp[MAX_PATH + 1];
    char *p;
    GetCurrentDirectory(MAX_PATH, szCwd);
    while ((p = strchr(szPath, '/')) && *p)
	*p = '\\';
    PathCombine(szTmp, szCwd, szPath);
    PathCanonicalize(szCwd, szTmp);
    printf("%s\n", szCwd);
    return 0;
}

/*
 * Local variables:
 *   mode: c
 *   c-basic-offset: 4
 *   fill-column: 78
 *   indent-tabs-mode: t
 *   tab-width: 8
 * End:
 */

Changes to generic/dom.c.

1198
1199
1200
1201
1202
1203
1204






1205
1206
1207
1208
1209
1210
1211
....
2492
2493
2494
2495
2496
2497
2498






2499
2500
2501
2502
2503
2504
2505
....
4564
4565
4566
4567
4568
4569
4570



4571
4572
4573
4574
4575
4576
4577
    if (!info->ignorexmlns) {
        for (atPtr = atts; atPtr[0] && atPtr[1]; atPtr += 2) {

            if (strncmp(atPtr[0], "xmlns", 5) == 0) {
                xmlns = atPtr[0];
                newNS = 1;
                if (xmlns[5] == ':') {






                    if (domIsNamespaceInScope (info->activeNS, info->activeNSpos,
                                               &(xmlns[6]), atPtr[1])) {
                        ns = domLookupPrefix (info->currentNode, &(xmlns[6]));
                        newNS = 0;
                    }
                    else {
                        ns = domNewNamespace(info->document, &xmlns[6], atPtr[1]);
................................................................................
        if (prefix[0] != '\0') {
            if (!domIsNCNAME (prefix)) {
                if (interp) {
                    Tcl_SetObjResult(interp, 
                                     Tcl_NewStringObj("invalid prefix name", -1));
                }
                return NULL;






            }
        }
        if (!domIsNCNAME (localName)) {
            if (interp) {
                Tcl_SetObjResult(interp, 
                                 Tcl_NewStringObj("invalid local name", -1));
            }
................................................................................
    node->nodeFlags     = 0;
    node->namespace     = 0;
    node->nodeNumber    = NODE_NO(doc);
    node->ownerDocument = doc;
    node->nodeName      = (char *)&(h->key);

    domSplitQName (tagName, prefix, &localname);



    ns = domNewNamespace(doc, prefix, uri);
    node->namespace = ns->index;

    if (doc->fragments) {
        node->nextSibling = doc->fragments;
        doc->fragments->previousSibling = node;
        doc->fragments = node;







>
>
>
>
>
>







 







>
>
>
>
>
>







 







>
>
>







1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
....
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
....
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
    if (!info->ignorexmlns) {
        for (atPtr = atts; atPtr[0] && atPtr[1]; atPtr += 2) {

            if (strncmp(atPtr[0], "xmlns", 5) == 0) {
                xmlns = atPtr[0];
                newNS = 1;
                if (xmlns[5] == ':') {
                    if (atPtr[1][0] == '\0') {
                        Tcl_SetResult (info->interp, "Missing URI in Namespace "
                               "declaration", NULL);
                        XML_StopParser(info->parser, 0);
                        return;
                    }
                    if (domIsNamespaceInScope (info->activeNS, info->activeNSpos,
                                               &(xmlns[6]), atPtr[1])) {
                        ns = domLookupPrefix (info->currentNode, &(xmlns[6]));
                        newNS = 0;
                    }
                    else {
                        ns = domNewNamespace(info->document, &xmlns[6], atPtr[1]);
................................................................................
        if (prefix[0] != '\0') {
            if (!domIsNCNAME (prefix)) {
                if (interp) {
                    Tcl_SetObjResult(interp, 
                                     Tcl_NewStringObj("invalid prefix name", -1));
                }
                return NULL;
            }
            if (uri[0] == '\0') {
                Tcl_SetObjResult(interp,
                                 Tcl_NewStringObj("Missing URI in "
                                                  "Namespace declaration", -1));
                return NULL;
            }
        }
        if (!domIsNCNAME (localName)) {
            if (interp) {
                Tcl_SetObjResult(interp, 
                                 Tcl_NewStringObj("invalid local name", -1));
            }
................................................................................
    node->nodeFlags     = 0;
    node->namespace     = 0;
    node->nodeNumber    = NODE_NO(doc);
    node->ownerDocument = doc;
    node->nodeName      = (char *)&(h->key);

    domSplitQName (tagName, prefix, &localname);
    if (prefix[0] == '\0' && uri[0] == '\0') {
        return NULL;
    }
    ns = domNewNamespace(doc, prefix, uri);
    node->namespace = ns->index;

    if (doc->fragments) {
        node->nextSibling = doc->fragments;
        doc->fragments->previousSibling = node;
        doc->fragments = node;

Changes to generic/domjson.c.

333
334
335
336
337
338
339

340
341
342
343
344
345
346
            DBG(fprintf(stderr, "Next array value node '%s'\n", &json[i]););
            skipspace(i);
            i = jsonParseValue (node, json, i, jparse);
            rc(i);
            skipspace(i);
            if (json[i] == ']') {
                jparse->within = savedWithin;

                return i+1;
            }
            if (json[i] == ',') {
                i++;
                continue;
            }
            errReturn(i,JSON_SYNTAX_ERR);







>







333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
            DBG(fprintf(stderr, "Next array value node '%s'\n", &json[i]););
            skipspace(i);
            i = jsonParseValue (node, json, i, jparse);
            rc(i);
            skipspace(i);
            if (json[i] == ']') {
                jparse->within = savedWithin;
                jparse->nestingDepth--;
                return i+1;
            }
            if (json[i] == ',') {
                i++;
                continue;
            }
            errReturn(i,JSON_SYNTAX_ERR);

Changes to generic/domxpath.c.

2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
....
2372
2373
2374
2375
2376
2377
2378
2379



2380
2381
2382
2383
2384
2385
2386
        newlen = strlen(xpath);
        *errMsg = (char*)REALLOC(*errMsg, len+newlen+10);
        memmove(*errMsg + len, " for '", 6);
        memmove(*errMsg + len+6, xpath, newlen);
        memmove(*errMsg + len+6+newlen, "' ", 3);

        for (i=0; tokens[i].token != EOS; i++) {
            sprintf(tmp, "%s\n%3s%3d %-12s %5ld %.3e %5d  ",
                         (i==0) ? "\n\nParsed symbols:" : "",
                         (i==l) ? "-->" : "   ",
                          i,
                         token2str[tokens[i].token-LPAR],
                         tokens[i].intvalue,
                         tokens[i].realvalue,
                         tokens[i].pos
................................................................................
    if (!(step->child)) return 1;
    if (step->child->type == IsElement) {
        if (node->nodeType == ELEMENT_NODE) {
            if ((step->child->strvalue[0] == '*') &&
                (step->child->strvalue[1] == '\0') &&
                (node->ownerDocument->rootNode != node) &&
                (step->child->intvalue == 0)) return 1;
            if (node->namespace) return 0;



            return (strcmp(node->nodeName, step->child->strvalue)==0);
        }
        return 0;
    } else
    if (step->child->type == IsAttr) {
        if (node->nodeType == ATTRIBUTE_NODE) {
            if (node->nodeFlags & IS_NS_NODE) return 0;







|







 







|
>
>
>







2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
....
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
        newlen = strlen(xpath);
        *errMsg = (char*)REALLOC(*errMsg, len+newlen+10);
        memmove(*errMsg + len, " for '", 6);
        memmove(*errMsg + len+6, xpath, newlen);
        memmove(*errMsg + len+6+newlen, "' ", 3);

        for (i=0; tokens[i].token != EOS; i++) {
            sprintf(tmp, "%s\n%3s%3d %-12s %5ld %09.3f %5d  ",
                         (i==0) ? "\n\nParsed symbols:" : "",
                         (i==l) ? "-->" : "   ",
                          i,
                         token2str[tokens[i].token-LPAR],
                         tokens[i].intvalue,
                         tokens[i].realvalue,
                         tokens[i].pos
................................................................................
    if (!(step->child)) return 1;
    if (step->child->type == IsElement) {
        if (node->nodeType == ELEMENT_NODE) {
            if ((step->child->strvalue[0] == '*') &&
                (step->child->strvalue[1] == '\0') &&
                (node->ownerDocument->rootNode != node) &&
                (step->child->intvalue == 0)) return 1;
            if (node->namespace
                && (node->ownerDocument->namespaces[node->namespace-1]->prefix[0] != '\0'
                    || node->ownerDocument->namespaces[node->namespace-1]->uri[0] != '\0')
                ) return 0;
            return (strcmp(node->nodeName, step->child->strvalue)==0);
        }
        return 0;
    } else
    if (step->child->type == IsAttr) {
        if (node->nodeType == ATTRIBUTE_NODE) {
            if (node->nodeFlags & IS_NS_NODE) return 0;

Changes to generic/nodecmd.c.

411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
...
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
...
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
...
591
592
593
594
595
596
597






598
599
600
601
602
603
604
...
664
665
666
667
668
669
670

671
672
673
674
675
676
677
...
703
704
705
706
707
708
709






710
711
712
713
714
715
716
...
718
719
720
721
722
723
724



725
726
727
728
729
730
731
                    break;
                }
            }
        } else {
            tag = nodeInfo->tagName;
        }

        newNode = domAppendNewElementNode (parent, tag, NULL);
        newNode->info = nodeInfo->jsonType;
        
        /*
         * Allow for following syntax:
         *   cmd ?-option value ...? ?script?
         *   cmd ?opton value ...? ?script?
         *   cmd key_value_list script
................................................................................
    Tcl_Obj *CONST  objv[];             /* Argument objects. */
    int             checkName;          /* Flag: Name checks? */
    int             checkCharData;      /* Flag: Data checks? */
{
    int index, ret, type, nodecmd = 0, jsonType = 0, haveJsonType = 0;
    int isElement = 0;
    char *nsName, buf[64];
    Tcl_Obj *tagName = NULL;
    Tcl_DString cmdName;
    NodeInfo *nodeInfo;

    /*
     * Syntax:  
     *
     *     dom createNodeCmd ?-returnNodeCmd? nodeType commandName
................................................................................

    static CONST84 char *subcmds[] = {
        "elementNode", "textNode", "cdataNode", "commentNode", "piNode",
        "parserNode", NULL
    };

    static CONST84 char *options[] = {
        "-returnNodeCmd", "-jsonType", "-tagName", NULL
    };

    enum option {
        o_returnNodeCmd, o_jsonType, o_tagName
    };

    static const char *jsonTypes[] = {
        "NONE",
        "ARRAY",
        "OBJECT",
        "NULL",
................................................................................
            break;
            
        case o_tagName:
            tagName = objv[2];
            objc -= 2;
            objv += 2;
            break;






            
        }
    }
    if (objc != 3) {
        goto usage;
    }

................................................................................
            }
        } else {
            if (jsonType < 3 && jsonType > 0) {
                Tcl_SetResult(interp, "For a text node the jsonType "
                              "argument must be one out of this list: "
                              "TRUE FALSE NULL NUMBER STRING NONE",
                              NULL);

            }
            type = TEXT_NODE;
        }
        break;
    case CDS_NODE: 
        if (checkCharData) {
            type = CDATA_SECTION_NODE_CHK;
................................................................................
    }

    if (tagName && !isElement) {
        Tcl_SetResult(interp, "The -tagName option is allowed only for "
                      "element node commands.", NULL);
        return TCL_ERROR;        
    }






    
    if (haveJsonType && type != ELEMENT_NODE && type != TEXT_NODE) {
        Tcl_SetResult(interp, "Only element and text nodes may have a "
                      "JSON type.", NULL);
        return TCL_ERROR;        
    }
    
................................................................................
    nodeInfo->namespace = NULL;
    nodeInfo->type = type;
    if (nodecmd) {
        nodeInfo->type *= -1; /* Signal this fact */
    }
    nodeInfo->jsonType = jsonType;
    nodeInfo->tagName = NULL;



    if (tagName) {
        nodeInfo->tagName = tdomstrdup (Tcl_GetString(tagName));
    }
    Tcl_CreateObjCommand(interp, Tcl_DStringValue(&cmdName), NodeObjCmd,
                         (ClientData)nodeInfo, NodeObjCmdDeleteProc);
    Tcl_DStringResult(interp, &cmdName);
    Tcl_DStringFree(&cmdName);







|







 







|







 







|



|







 







>
>
>
>
>
>







 







>







 







>
>
>
>
>
>







 







>
>
>







411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
...
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
...
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
...
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
...
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
...
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
...
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
                    break;
                }
            }
        } else {
            tag = nodeInfo->tagName;
        }

        newNode = domAppendNewElementNode (parent, tag, nodeInfo->namespace);
        newNode->info = nodeInfo->jsonType;
        
        /*
         * Allow for following syntax:
         *   cmd ?-option value ...? ?script?
         *   cmd ?opton value ...? ?script?
         *   cmd key_value_list script
................................................................................
    Tcl_Obj *CONST  objv[];             /* Argument objects. */
    int             checkName;          /* Flag: Name checks? */
    int             checkCharData;      /* Flag: Data checks? */
{
    int index, ret, type, nodecmd = 0, jsonType = 0, haveJsonType = 0;
    int isElement = 0;
    char *nsName, buf[64];
    Tcl_Obj *tagName = NULL, *namespace = NULL;
    Tcl_DString cmdName;
    NodeInfo *nodeInfo;

    /*
     * Syntax:  
     *
     *     dom createNodeCmd ?-returnNodeCmd? nodeType commandName
................................................................................

    static CONST84 char *subcmds[] = {
        "elementNode", "textNode", "cdataNode", "commentNode", "piNode",
        "parserNode", NULL
    };

    static CONST84 char *options[] = {
        "-returnNodeCmd", "-jsonType", "-tagName", "-namespace", NULL
    };

    enum option {
        o_returnNodeCmd, o_jsonType, o_tagName, o_namespace
    };

    static const char *jsonTypes[] = {
        "NONE",
        "ARRAY",
        "OBJECT",
        "NULL",
................................................................................
            break;
            
        case o_tagName:
            tagName = objv[2];
            objc -= 2;
            objv += 2;
            break;

        case o_namespace:
            namespace = objv[2];
            objc -= 2;
            objv += 2;
            break;
            
        }
    }
    if (objc != 3) {
        goto usage;
    }

................................................................................
            }
        } else {
            if (jsonType < 3 && jsonType > 0) {
                Tcl_SetResult(interp, "For a text node the jsonType "
                              "argument must be one out of this list: "
                              "TRUE FALSE NULL NUMBER STRING NONE",
                              NULL);
                return TCL_ERROR;
            }
            type = TEXT_NODE;
        }
        break;
    case CDS_NODE: 
        if (checkCharData) {
            type = CDATA_SECTION_NODE_CHK;
................................................................................
    }

    if (tagName && !isElement) {
        Tcl_SetResult(interp, "The -tagName option is allowed only for "
                      "element node commands.", NULL);
        return TCL_ERROR;        
    }

    if (namespace && !isElement) {
        Tcl_SetResult(interp, "The -namespace option is allowed only for "
                      "element node commands.", NULL);
        return TCL_ERROR;        
    }
    
    if (haveJsonType && type != ELEMENT_NODE && type != TEXT_NODE) {
        Tcl_SetResult(interp, "Only element and text nodes may have a "
                      "JSON type.", NULL);
        return TCL_ERROR;        
    }
    
................................................................................
    nodeInfo->namespace = NULL;
    nodeInfo->type = type;
    if (nodecmd) {
        nodeInfo->type *= -1; /* Signal this fact */
    }
    nodeInfo->jsonType = jsonType;
    nodeInfo->tagName = NULL;
    if (namespace) {
        nodeInfo->namespace = tdomstrdup (Tcl_GetString(namespace));
    }
    if (tagName) {
        nodeInfo->tagName = tdomstrdup (Tcl_GetString(tagName));
    }
    Tcl_CreateObjCommand(interp, Tcl_DStringValue(&cmdName), NodeObjCmd,
                         (ClientData)nodeInfo, NodeObjCmdDeleteProc);
    Tcl_DStringResult(interp, &cmdName);
    Tcl_DStringFree(&cmdName);

Changes to generic/tcldom.c.

210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
....
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
....
5586
5587
5588
5589
5590
5591
5592




5593
5594
5595
5596
5597
5598
5599
    "    createDocument docElemName ?objVar?              \n"
    "    createDocumentNS uri docElemName ?objVar?        \n"
    "    createDocumentNode ?objVar?                      \n"
    TDomThreaded(
    "    attachDocument domDoc ?objVar?                   \n"
    "    detachDocument domDoc                            \n"
    )
    "    createNodeCmd ?-returnNodeCmd? (element|comment|text|cdata|pi)Node cmdName \n"
    "    setResultEncoding ?encodingName?                 \n"
    "    setStoreLineColumn ?boolean?                     \n"
    "    setNameCheck ?boolean?                           \n"
    "    setTextCheck ?boolean?                           \n"
    "    setObjectCommands ?(automatic|token|command)?    \n"
    "    isCharData string                                \n"
    "    isComment string                                 \n"
................................................................................
    int         objc,
    Tcl_Obj    *CONST objv[]
)
{
    char          *xpathQuery, *typeVar, *option;
    char          *errMsg = NULL, **mappings = NULL;
    int            rc, i, len, optionIndex, localmapping = 0, cache = 0;
    int            mappingListObjLen;
    xpathResultSet rs;
    Tcl_Obj       *type, *objPtr, *objPtr1, *mappingListObj;
    xpathCBs       cbs;
    xpathParseVarCB parseVarCB;

    static CONST84 char *selectNodesOptions[] = {
        "-namespaces", "-cache", NULL
    };
    enum selectNodesOption {
................................................................................

        case m_createElementNS:
            CheckArgs(4,5,2,"elementName uri ?newObjVar?");
            uri = Tcl_GetString(objv[2]);
            tag = Tcl_GetString(objv[3]);
            CheckName (interp, tag, "full qualified tag", 1);
            n = domNewElementNodeNS(doc, tag, uri);




            return tcldom_setInterpAndReturnVar(interp, n, (objc == 5),
                                        (objc == 5) ? objv[4] : NULL);

        case m_createTextNode:
            CheckArgs(3,4,2,"data ?newObjVar?");
            data = Tcl_GetStringFromObj(objv[2], &data_length);
            CheckText (interp, data, "text");







|







 







|

|







 







>
>
>
>







210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
....
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
....
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
    "    createDocument docElemName ?objVar?              \n"
    "    createDocumentNS uri docElemName ?objVar?        \n"
    "    createDocumentNode ?objVar?                      \n"
    TDomThreaded(
    "    attachDocument domDoc ?objVar?                   \n"
    "    detachDocument domDoc                            \n"
    )
    "    createNodeCmd ?-returnNodeCmd? ?-tagName name? ?-jsonType jsonType? ?-namespace URI? (element|comment|text|cdata|pi)Node cmdName \n"
    "    setResultEncoding ?encodingName?                 \n"
    "    setStoreLineColumn ?boolean?                     \n"
    "    setNameCheck ?boolean?                           \n"
    "    setTextCheck ?boolean?                           \n"
    "    setObjectCommands ?(automatic|token|command)?    \n"
    "    isCharData string                                \n"
    "    isComment string                                 \n"
................................................................................
    int         objc,
    Tcl_Obj    *CONST objv[]
)
{
    char          *xpathQuery, *typeVar, *option;
    char          *errMsg = NULL, **mappings = NULL;
    int            rc, i, len, optionIndex, localmapping = 0, cache = 0;
    int            mappingListObjLen = 0;
    xpathResultSet rs;
    Tcl_Obj       *type, *objPtr, *objPtr1, *mappingListObj = NULL;
    xpathCBs       cbs;
    xpathParseVarCB parseVarCB;

    static CONST84 char *selectNodesOptions[] = {
        "-namespaces", "-cache", NULL
    };
    enum selectNodesOption {
................................................................................

        case m_createElementNS:
            CheckArgs(4,5,2,"elementName uri ?newObjVar?");
            uri = Tcl_GetString(objv[2]);
            tag = Tcl_GetString(objv[3]);
            CheckName (interp, tag, "full qualified tag", 1);
            n = domNewElementNodeNS(doc, tag, uri);
            if (n == NULL) {
                SetResult("Missing URI in Namespace declaration");
                return TCL_ERROR;
            }
            return tcldom_setInterpAndReturnVar(interp, n, (objc == 5),
                                        (objc == 5) ? objv[4] : NULL);

        case m_createTextNode:
            CheckArgs(3,4,2,"data ?newObjVar?");
            data = Tcl_GetStringFromObj(objv[2], &data_length);
            CheckText (interp, data, "text");

Changes to tdom.m4.

239
240
241
242
243
244
245



246

247
248
249
250
251
252
253
    fi
    HTML5_LIBS=""
    if test "$tcl_ok" = "yes" ; then
        HAVEGUMBO=`pkg-config --exists gumbo && echo "1"`
        if test "$HAVEGUMBO" = "1" ; then
            AC_MSG_RESULT([yes])
            AC_DEFINE(TDOM_HAVE_GUMBO)



            HTML5_LIBS="`pkg-config --cflags --libs gumbo`"

        else
            AC_MSG_ERROR([The required lib gumbo not found])
        fi
    else    
        AC_MSG_RESULT([no])
    fi
])







>
>
>
|
>







239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
    fi
    HTML5_LIBS=""
    if test "$tcl_ok" = "yes" ; then
        HAVEGUMBO=`pkg-config --exists gumbo && echo "1"`
        if test "$HAVEGUMBO" = "1" ; then
            AC_MSG_RESULT([yes])
            AC_DEFINE(TDOM_HAVE_GUMBO)
            if test "${TEA_PLATFORM}" = "windows" ; then
                HTML5_LIBS="-Wl,-Bstatic `pkg-config --static --cflags --libs gumbo` -Wl,-Bdynamic"
            else
                HTML5_LIBS="`pkg-config --cflags --libs gumbo`"
            fi
        else
            AC_MSG_ERROR([The required lib gumbo not found])
        fi
    else    
        AC_MSG_RESULT([no])
    fi
])

Changes to tests/all.tcl.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
            ::tcltest::testConstraint] == -1} {
        set ::tcltest::testConfig(need_i18n) 1
        set ::tcltest::testConstraints(need_i18n) 1
        if {[info procs ::tDOM::extRefHandler] != ""} {
            set ::tcltest::testConfig(need_uri) 1
            set ::tcltest::testConstraints(need_uri) 1
        }
   } else {
        ::tcltest::testConstraint need_i18n 1
       if {[info procs ::tDOM::extRefHandler] != ""} {
           ::tcltest::testConstraint need_uri 1
       }
    }
}

set timeCmd {clock format [clock seconds]}

set ::tcltest::testSingleFile false








|

|
|
|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
            ::tcltest::testConstraint] == -1} {
        set ::tcltest::testConfig(need_i18n) 1
        set ::tcltest::testConstraints(need_i18n) 1
        if {[info procs ::tDOM::extRefHandler] != ""} {
            set ::tcltest::testConfig(need_uri) 1
            set ::tcltest::testConstraints(need_uri) 1
        }
    } else {
        ::tcltest::testConstraint need_i18n 1
        if {[info procs ::tDOM::extRefHandler] != ""} {
            ::tcltest::testConstraint need_uri 1
        }
    }
}

set timeCmd {clock format [clock seconds]}

set ::tcltest::testSingleFile false

Changes to tests/dom.test.

113
114
115
116
117
118
119

































120
121
122
123
124
125
126
...
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
...
532
533
534
535
536
537
538





539
540
541
542
543
544
545
    }
    set nrOfCommands [llength [info commands]]
    set doc [dom createDocument root]
    rename $doc fooCmd
    fooCmd delete
    expr {[llength [info commands]] == $nrOfCommands}
} {1}


































test dom-2.1 {Don't quash white space at start or end of non white space content} {
    set doc [dom parse {<root>
    some content
    </root>}]
    set root [$doc documentElement]
    $root text
................................................................................
test dom-2.28 {parse document with undeclared xml prefix} {
    catch {dom parse {<doc><foo:e/></doc>}} errMsg
    string range $errMsg 0 30
} {Namespace prefix is not defined}

# This is an expat bug. If XML_StopParser is called in the
# elementstarthandler function for the document element and there
# isn't anything else in the document then this document element, then
# the XML_Parse() return code doesn't reflects this. This is an edge
# case, see the next test below.
test dom-2.29 {parse not well-formed document with undeclared xml prefix} {knownBug} {
    catch {dom parse {<foo:e/>}} errMsg
    string range $errMsg 0 30
} {Namespace prefix is not defined}

................................................................................
test dom-2.33 {end of options option} {
    set doc [dom parse -json -- -0.123]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} -0.123






test dom-3.1 {isName} {
    dom isName ":foo"
} {1}

test dom-3.2 {isName} {
    dom isName "_foo"
} {1}







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|







 







>
>
>
>
>







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
...
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
...
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
    }
    set nrOfCommands [llength [info commands]]
    set doc [dom createDocument root]
    rename $doc fooCmd
    fooCmd delete
    expr {[llength [info commands]] == $nrOfCommands}
} {1}

test dom-1.16 {createDocumentNS - empty namespace, no prefix} {
    dom createDocumentNS "" doc doc
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<doc/>}

test dom-1.17 {createDocumentNS -  namespace, no prefix} {
    dom createDocumentNS "uri" doc doc
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<doc xmlns="uri"/>}

test dom-1.18 {createDocumentNS -  namespace, no prefix} {
    dom createDocumentNS "uri" doc doc
    set result [$doc selectNodes -namespaces {ns uri} count(/ns:doc)]
    $doc delete
    set result
} 1

test dom-1.19 {createDocumentNS - namespace, prefix} {
    dom createDocumentNS "uri" n1:doc doc
    set result [$doc selectNodes -namespaces {ns uri} count(/ns:doc)]
    $doc delete
    set result
} 1

test dom-1.20 {createDocumentNS - empty namespace, prefix} {
    catch {dom createDocumentNS "" n1:doc doc} errMsg
    set errMsg
} {Missing URI in Namespace declaration}

test dom-2.1 {Don't quash white space at start or end of non white space content} {
    set doc [dom parse {<root>
    some content
    </root>}]
    set root [$doc documentElement]
    $root text
................................................................................
test dom-2.28 {parse document with undeclared xml prefix} {
    catch {dom parse {<doc><foo:e/></doc>}} errMsg
    string range $errMsg 0 30
} {Namespace prefix is not defined}

# This is an expat bug. If XML_StopParser is called in the
# elementstarthandler function for the document element and there
# isn't anything else in the document than this document element, then
# the XML_Parse() return code doesn't reflects this. This is an edge
# case, see the next test below.
test dom-2.29 {parse not well-formed document with undeclared xml prefix} {knownBug} {
    catch {dom parse {<foo:e/>}} errMsg
    string range $errMsg 0 30
} {Namespace prefix is not defined}

................................................................................
test dom-2.33 {end of options option} {
    set doc [dom parse -json -- -0.123]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} -0.123

test dom-2.34 {XML prefix declaration with empty namespace} {
    catch {dom parse {<foo:doc xmlns:foo=""><e1/></foo:doc>}} errMsg
    set errMsg
} {Missing URI in Namespace declaration, referenced at line 1 character 22}

test dom-3.1 {isName} {
    dom isName ":foo"
} {1}

test dom-3.2 {isName} {
    dom isName "_foo"
} {1}

Changes to tests/domDoc.test.

27
28
29
30
31
32
33

34
35
36
37
38
39
40
....
1394
1395
1396
1397
1398
1399
1400


















1401
1402
1403
1404
1405
1406
1407
....
1457
1458
1459
1460
1461
1462
1463





























1464
1465
1466
1467
#    domDoc-21.*: baseURI
#    domDoc-22.*: appendFromScript
#    domDoc-23.*: getElementsByTagNameNS
#    domDoc-24.*: cdataSectionElements
#    domDoc-25.*: selectNodesNamespaces
#    domDoc-26.*: fragments list
#    domDoc-27.*: deleteXPathCache

#
# Copyright (c) 2004 - 2007 Rolf Ade.

source [file join [file dir [info script]] loadtdom.tcl]

test domDoc-1.1 {asXML -escapeNonASCII} {need_i18n} {
    set doc [dom parse [tDOM::xmlReadFile \
................................................................................
    set node [$doc selectNodes default1:root/default2:elem1]
    set result [list [$node prefix] [$node localName]]
    set node [$doc selectNodes default1:root/default2:elem1/elem11]
    lappend result [$node nodeName] [$node namespaceURI]
    $doc delete
    set result
} {{} elem1 elem11 {}}



















test domDoc-25.8 {selectNodesNamespaces} {
    set doc [dom parse {<root xmlns="rootdefaultNS">
        <elem1 xmlns="elem1NS"><elem11 xmlns=""/></elem1>
        <elem2 xmlns="elem2NS"/>
        </root>}]
    $doc selectNodesNamespaces {default2 elem1NS default1 rootdefaultNS}
................................................................................
    lappend result [$doc deleteXPathCache foo/bar]
    lappend result [$doc deleteXPathCache 2+2]
    lappend result [$doc deleteXPathCache]
    $doc selectNodes -cache 1 2+2
    $doc delete
    set result
} {{} {} {} {}}






























# cleanup
::tcltest::cleanupTests
return







>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
....
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
....
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
#    domDoc-21.*: baseURI
#    domDoc-22.*: appendFromScript
#    domDoc-23.*: getElementsByTagNameNS
#    domDoc-24.*: cdataSectionElements
#    domDoc-25.*: selectNodesNamespaces
#    domDoc-26.*: fragments list
#    domDoc-27.*: deleteXPathCache
#    domDoc-28.*: createElementNS
#
# Copyright (c) 2004 - 2007 Rolf Ade.

source [file join [file dir [info script]] loadtdom.tcl]

test domDoc-1.1 {asXML -escapeNonASCII} {need_i18n} {
    set doc [dom parse [tDOM::xmlReadFile \
................................................................................
    set node [$doc selectNodes default1:root/default2:elem1]
    set result [list [$node prefix] [$node localName]]
    set node [$doc selectNodes default1:root/default2:elem1/elem11]
    lappend result [$node nodeName] [$node namespaceURI]
    $doc delete
    set result
} {{} elem1 elem11 {}}

test domDoc-25.7.1 {selectNodesNamespaces} {
    set doc [dom parse {<root xmlns="rootdefaultNS">
        <elem1 xmlns="elem1NS"/>
        <elem2 xmlns="elem2NS"/>
        </root>}]
    $doc documentElement root
    $root firstChild elem1
    $doc createElement elem11 elem11
    $elem1 appendChild $elem11
    $doc selectNodesNamespaces {default2 elem1NS default1 rootdefaultNS}
    set node [$doc selectNodes default1:root/default2:elem1]
    set result [list [$node prefix] [$node localName]]
    set node [$doc selectNodes default1:root/default2:elem1/elem11]
    lappend result [$node nodeName] [$node namespaceURI]
    $doc delete
    set result
} {{} elem1 elem11 {}}

test domDoc-25.8 {selectNodesNamespaces} {
    set doc [dom parse {<root xmlns="rootdefaultNS">
        <elem1 xmlns="elem1NS"><elem11 xmlns=""/></elem1>
        <elem2 xmlns="elem2NS"/>
        </root>}]
    $doc selectNodesNamespaces {default2 elem1NS default1 rootdefaultNS}
................................................................................
    lappend result [$doc deleteXPathCache foo/bar]
    lappend result [$doc deleteXPathCache 2+2]
    lappend result [$doc deleteXPathCache]
    $doc selectNodes -cache 1 2+2
    $doc delete
    set result
} {{} {} {} {}}

test domDoc-28.1 {createElementNS} {
    set doc [dom createDocument doc]
    set newElem [$doc createElementNS uri ns:e]
    $doc documentElement root
    $root appendChild $newElem
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<doc><ns:e xmlns:ns="uri"/></doc>}

test domDoc-28.2 {createElementNS} {
    set doc [dom createDocument doc]
    set newElem [$doc createElementNS uri ns:e]
    $newElem setAttributeNS uri ns:att value
    $doc documentElement root
    $root appendChild $newElem
    set result [$doc selectNodes -namespaces {ns uri} string(/doc/ns:e/@ns:att)]
    $doc delete
    set result
} {value}

test domDoc-28.3 {createElementNS} {
    set doc [dom createDocument doc]
    catch {$doc createElementNS "" e} errMsg
    $doc delete
    set errMsg
} {Missing URI in Namespace declaration}


# cleanup
::tcltest::cleanupTests
return

Changes to tests/domNode.test.

393
394
395
396
397
398
399








400
401
402
403
404
405
406
    $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
    set result [$root asXML]
    $doc delete
    set result
} {<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"/>
}









test domNode-5.1 {removeChild} {
    dom parse {<root><child/></root>} doc
    $doc documentElement root
    $root removeChild [$root firstChild]
    set result [$doc asXML -indent none]
    $doc delete
    set result







>
>
>
>
>
>
>
>







393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
    $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
    set result [$root asXML]
    $doc delete
    set result
} {<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"/>
}

test domNode-4.18 {setAttributeNS - prefixed attribute name with empty namespace} {
    set doc [dom createDocument "root"]
    set root [$doc documentElement]
    catch {$root setAttributeNS "" ns:att attvalue} errMsg
    $doc delete
    set errMsg
} {For all prefixed attributes with prefixes other than 'xml' or 'xmlns' you have to provide a namespace URI}

test domNode-5.1 {removeChild} {
    dom parse {<root><child/></root>} doc
    $doc documentElement root
    $root removeChild [$root firstChild]
    set result [$doc asXML -indent none]
    $doc delete
    set result

Added tests/domjson.test.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
# Features covered: JSON parser
#
# This file contains a collection of tests for the JSON parser.
# Tested functionalities:
#    json-1.*: JSON syntax tests
#    json-2.*: Valid JSON, that could not parsed into DOM
#    json-3.*: JSON unescaping
#    json-4.*: Unicode
#    json-5.*: Max nesting
#    json-6.*: asJSON
#    json-7.*: jsonType
#    json-7.*: appendFromScript
# Copyright (c) 2017 Rolf Ade.

source [file join [file dir [info script]] loadtdom.tcl]


namespace eval nodeCmds {
    dom createNodeCmd elementNode e1
    dom createNodeCmd -jsonType ARRAY elementNode jae1
    dom createNodeCmd elementNode e2
    dom createNodeCmd commentNode c
    dom createNodeCmd textNode    t
    dom createNodeCmd -jsonType TRUE textNode true
    dom createNodeCmd -jsonType FALSE textNode false
    dom createNodeCmd -jsonType NULL textNode null
    dom createNodeCmd -jsonType NUMBER textNode number
    dom createNodeCmd cdataNode   cdata
    dom createNodeCmd piNode      pi
}

test json-1.1 {Parse JSON} {
    set doc [dom parse -json {{"a":"avalue","b":"bvalue","c":0.123}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<a>avalue</a><b>bvalue</b><c>0.123</c>"

test json-1.2 {Parse JSON} {
    set doc [dom parse -json { {"a" : [ "avalue" ] } }]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<a>avalue</a>}

test json-1.3 {Parse JSON} {
    set doc [dom parse -json {{"a":"a value","b":"1value"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<a>a value</a><b>1value</b>"

test json-1.4 {Parse JSON - nested object} {
    set doc [dom parse -json {{"a":{"aa":"aavalue","bb":"bbvalue"},"b":"bvalue","c":0.123}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<a><aa>aavalue</aa><bb>bbvalue</bb></a><b>bvalue</b><c>0.123</c>"

test json-1.5 {Parse JSON - array} {
    set doc [dom parse -json {{"a": [1,2,3,4,"abc"]}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<a>1234abc</a>"

test json-1.6 {Parse JSON - true, false, null} {
    set doc [dom parse -json {{"a":true,"b":false,"c":null,"d":"true","e":""}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<a>true</a><b>false</b><c>null</c><d>true</d><e></e>}

test json-1.7 {Parse JSON - array in nested object} {
    set doc [dom parse -json {{"a":{"aa":[1,2,3,4,"abc"]},"b":"bvalue"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<a><aa>1234abc</aa></a><b>bvalue</b>"

test json-1.8 {Parse JSON - true, false, null} {
    set doc [dom parse -json -jsonroot "JSONObject" {{"a":true,"b":false,"c":null,"d":"true","e":""}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<JSONObject><a>true</a><b>false</b><c>null</c><d>true</d><e></e></JSONObject>}

test json-1.9 {JSON syntax error} {
    set result [catch {dom parse -json {{"a" "a value"}}} errMsg]
    list $result $errMsg
} {1 {error "JSON syntax error" at position 5
"{"a" " <--Error-- a value"}"}}

test json-1.10 {JSON syntax error} {
    set result [catch {dom parse -json {{"a":00.23}}} errMsg]
    list $result $errMsg
} {1 {error "JSON syntax error" at position 6
"{"a":00 <--Error-- .23}"}}

test json-1.11 {JSON syntax error} {
    set result [catch {dom parse -json {{"a":-00.23}}} errMsg]
    list $result $errMsg
} {1 {error "JSON syntax error" at position 7
"{"a":-00 <--Error-- .23}"}}

test json-1.12 {JSON syntax error} {
    set result [catch {dom parse -json {{"a":.23}}} errMsg]
    list $result $errMsg
} {1 {error "JSON syntax error" at position 5
"{"a":. <--Error-- 23}"}}

test json-1.13 {JSON syntax error} {
    set result [catch {dom parse -json {{"a":-.23}}} errMsg]
    list $result $errMsg
} {1 {error "JSON syntax error" at position 6
"{"a":-. <--Error-- 23}"}}

test json-1.14 {JSON syntax error} {
    set result [catch {dom parse -json {{"a":-}}} errMsg]
    list $result $errMsg
} {1 {error "JSON syntax error" at position 5
"{"a":- <--Error-- }"}}

test json-1.15 {Parse JSON - nested object} {
    set doc [dom parse -json {["a",["aa","bb"],"b"]}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "a<arraycontainer>aabb</arraycontainer>b"

set notJsons {
    {{null}}
    {{1.23}}
    {{"string"}}
    {{"e":}}
}
test json-1.16 {Invalid input} {
    set result ""
    set ind 0
    foreach notJson $notJsons {
        if {![catch {dom parse -json $notJson docNode} errMsg]} {
            lappend result $errMsg
        }
    }
    set result
} ""

test json-1.17 {Literal binary 0 (NUL, '\0') is not allowed in input} {
    catch {dom parse -json "\"a\u0000\""}
} 1

test json-1.18 {Escaped binary 0 (NUL, '\0') is OK} {
    dom parse -json "\"a\\u0000\"" doc
    set result [$doc asJSON]
    $doc delete
    set result
} "\"a\\u0000\""

test json-1.19 {Invalid input - uncompled \u escape} {
    catch {dom parse -json {"ab\u00"}}
} 1

test json-1.20 {Escaped binary 0} {
    dom parse -json "\"a\\u0000\"" doc
    set textvalue [$doc selectNodes string(node())]
    set result [string length $textvalue]
    binary scan $textvalue c2 result2
    lappend result {*}$result2
    $doc delete
    set result
} {2 97 0}

test json-2.1 {invalid xml name} {
    set doc [dom parse -json {{"a":"a value","1b":"1value", "a\nb":"a\nb", "":"empty string"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<a>a value</a><1b>1value</1b><a
b>a
b</a
b><>empty string</>}

test json-3.1 {Unescaping} {
    set doc [dom parse -json {{"a":"a\nvalue","b":"value\tvalue"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<a>a
value</a><b>value\tvalue</b>"

test json-3.2 {Unescaping} {
    set doc [dom parse -json {{"a":"a\nvalue", "b":"12\u0077\u2221ec"}}]
    set result [$doc asXML -indent none -escapeNonASCII]
    $doc delete
    set result
} "<a>a
value</a><b>12w&#8737;ec</b>"

test json-3.3 {Unescaping} {
    set doc [dom parse -json {{"a":"\u0077\u2221"}}]
    set result [$doc asXML -indent none -escapeNonASCII]
    $doc delete
    set result
} "<a>w&#8737;</a>"

test json-3.4 {unescaping} {
    set doc [dom parse -jsonroot json -json {["\\a"]}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<json>\a</json>}

test json-3.4.1 {unescaping} {
    set doc [dom parse -jsonroot json -json {["\\a","\u0071"]}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<json>\aq</json>}

test json-3.5 {unescaping} {
    set result [catch {dom parse -json {{"this":"a\lb"}}} errMsg]
    list $result $errMsg
} {1 {error "JSON syntax error" at position 11
"{"this":"a\l <--Error-- b"}"}}

test json-3.6 {unescaping} {
    set doc [dom parse -json {{"this":"a\nbc"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<this>a
bc</this>} 

test json-3.7 {unescaping} {
    set doc [dom parse -json {{"this":"a\u0077\t\u0078bc"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<this>aw\txbc</this>"

test json-3.8 {unescaping} {
    set doc [dom parse -json {{"this":"a\u000b"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<this>a\u000b</this>"

test json-3.9 {unescaping} {
    set doc [dom parse -json {{"this":"a\u0077","that":"\t\u0078bc"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<this>aw</this><that>\txbc</that>"

test json-5.1 {-jsonmaxnesting 0} {
    set result [catch {dom parse -json -jsonmaxnesting 0 {{"this":"that"}}} errMsg]
    list $result $errMsg
} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 0
"{ <--Error-- "this":"that"}"}}

test json-5.2 {-jsonmaxnesting 0} {
    set result [catch {dom parse -json -jsonmaxnesting 0 {["this","that"]}} errMsg]
    list $result $errMsg
} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 0
"[ <--Error-- "this","that"]"}}

test json-5.3 {-jsonmaxnesting 0} {
    set result [catch {dom parse -jsonroot o -json -jsonmaxnesting 0 {["this","that"]}} errMsg]
    list $result $errMsg
} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 0
"[ <--Error-- "this","that"]"}}

test json-5.4 {-jsonmaxnesting} {
    set doc [dom parse -json -jsonmaxnesting 2 {{"this":{"foo":"that"}}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<this><foo>that</foo></this>}

test json-5.5 {-jsonmaxnesting} {
    set result [catch {dom parse -json -jsonmaxnesting 1 \
                           {{"this":{"foo":"that"}}}} errMsg]
    list $result $errMsg
} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 8
"{"this":{ <--Error-- "foo":"that"}}"}}

test json-5.6 {-jsonmaxnesting} {
    set doc [dom parse -json -jsonmaxnesting 2 {
        {
            "this": {
                "foo":"that",
                "bar":"grill"
            },
            "two": "value",
            "three": {
                "t1":"t1value",
                "t2":"t2value"
            },
            "four": ["a","b","c"]
        }}]
    set result [$doc asXML]
    $doc delete
    set result
} {<this>
    <foo>that</foo>
    <bar>grill</bar>
</this>
<two>value</two>
<three>
    <t1>t1value</t1>
    <t2>t2value</t2>
</three>
<four>abc</four>
}

set jsons {
    {{"a":"avalue","b":"bvalue","c":0.123}}
    {{"a":["avalue"]}}
    {{"a":"a value","b":"1value"}}
    {{"a":{"aa":"aavalue","bb":"bbvalue"},"b":"bvalue","c":0.123}}
    {{"a":[1,2,3,4,"abc"]}}
    {{"a":true,"b":false,"c":null,"d":"true","e":""}}
    {{"a":{"aa":[1,2,3,4,"abc"]},"b":"bvalue"}}
    {{"a":true,"b":false,"c":null,"d":"true","e":""}}
    {["a",["aa","bb"],"b"]}
    {{"a":"a\nvalue","b":"value\tvalue"}}
    {["\\\\a"]}
    {["a\"b"]}
    {{"b":"a \"b c\" d","b":"a \"b c\" d"}}
    {{"this":"a\nbc"}}
    {{"this":{"foo":"that"}}}
    {{"this":{"foo":"that","bar":"grill"},"two":"value","three":{"t1":"t1value","t2":"t2value"},"four":["a","b","c"]}}
    {"only a string"}
    {null}
    {1.23}
    {true}
    {false}
    {{}}
    {[]}
    {[[]]}
    {[["x"]]}
    {""}
    {[[[[["a"]]]]]}
    {{"x":[{"id":"foo"}]}}
    {"http://foo.bar"}
}
test json-6.1 {asJSON} {
    set failedlist [list]
    set ind 0
    foreach json $jsons {
        set doc [dom parse -json $json]
        set out [$doc asJSON]
        if {$json ne $out} {
            lappend failedlist "$ind : '$json' : '$out'"
        }
        incr ind
    }
    set failedlist
} {}

test json-6.2 {asJSON - slash will not be escaped while serializing} {
    set doc [dom parse -json {"http:\/\/foo.bar"}]
    set result [$doc asJSON]
    $doc delete
    set result
} {"http://foo.bar"}

test json-6.3 {asJSON - docNode serialization} {
    dom createDocumentNode docNode
    set result [$docNode asJSON]
    $docNode delete
    set result
} {{}}

test json-6.4 {asJSON - doc serialization} {
    dom createDocument root docNode
    set result [$docNode asJSON]
    $docNode delete
    set result
} {{"root":""}}

test json-6.5 {asJSON - serialization of control characters} {
    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\""]
    set result [$doc asJSON]
    $doc delete
    set result
} {"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"}

test json-7.1 {jsonType} {
    set doc [dom parse {<j>foo</j>}]
    set root [$doc documentElement]
    set result [list]
    lappend result [$root asJSON]
    lappend result [$root jsonType]
    $root jsonType ARRAY
    lappend result [$root asJSON]
    $doc delete
    set result
} {{"foo"} NONE {["foo"]}}

test json-7.2 {jsonType} {
    set doc [dom createDocumentNode]
    set result [$doc jsonType]
    lappend result [$doc asJSON]
    lappend result [catch {$doc jsonType foo}]
    $doc jsonType ARRAY
    lappend result [$doc asJSON]
    $doc jsonType OBJECT
    lappend result [$doc asJSON]
    $doc delete
    set result
} {NONE {{}} 1 {[]} {{}}}

test json-8.1 {appendFromScript} {
    set doc [dom createDocumentNode]
    $doc appendFromScript {
        nodeCmds::e1
    }
    set result [list]
    lappend result [$doc asJSON]
    set root [$doc documentElement]
    lappend result [$root asJSON]
    $doc removeChild [$doc firstChild]
    $doc appendFromScript {
        nodeCmds::jae1
    }
    lappend result [$doc asJSON]
    set root [$doc documentElement]
    lappend result [$root asJSON]
    lappend result [$root jsonType]
    $doc delete
    set result
} {{{"e1":""}} {{}} {{"jae1":[]}} {[]} ARRAY}

test json-8.2 {appendFromScript} {
    set doc [dom createDocumentNode]
    $doc appendFromScript {
        nodeCmds::t "some string"
    }
    set result [$doc asJSON]
    $doc delete
    set result
} {"some string"}

test json-8.3 {appendFromScript} {
    set doc [dom createDocumentNode]
    $doc appendFromScript {
        nodeCmds::t ""
        nodeCmds::true ""
        nodeCmds::false ""
        nodeCmds::null ""
    }
    set result [$doc asJSON]
    $doc delete
    set result
} {["",true,false,null]}

test json-8.4 {appendFromScript - text node with type NUMBER} {
    set doc [dom createDocumentNode]
    $doc appendFromScript {
        nodeCmds::number ""
        nodeCmds::number "0"
        nodeCmds::number "123456789012345678901234567890.12345679e-0003"
        nodeCmds::number "42 "
        nodeCmds::number " 42"
        nodeCmds::number "-"
    }
    set result [$doc asJSON]
    $doc delete
    set result
} {["",0,123456789012345678901234567890.12345679e-0003,"42 "," 42","-"]}

test json-8.5 {createNodeCmd - wrong jsonType} {
    catch {dom createNodeCmd -jsonType OBJECT textNode textNodeWithJsonTypeObject}
} 1

Changes to tests/domnamespace.test.

2
3
4
5
6
7
8

9
10
11
12
13
14
15
...
310
311
312
313
314
315
316




































































317
318
319
#
# This file contains a collection of tests for some namespace related
# actions.
#
#    domnamespace-1.*: misc tests
#    domnamespace-2.*: moving namespaced nodes from one document to another
#    domnamespace-3.*: moving namespaced nodes within a document

#
# Copyright (c) 2002 Rolf Ade.
#
# RCS: @(#) $Id$

source [file join [file dir [info script]] loadtdom.tcl]

................................................................................
    set newParent [$doc selectNodes {/doc/node()[2]}]
    $newParent appendChild $nodeToMove
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<doc><e xmlns="foo"/><e xmlns="bar"><ee xmlns="foo"/></e></doc>}





































































# cleanup
::tcltest::cleanupTests
return







>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
...
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
#
# This file contains a collection of tests for some namespace related
# actions.
#
#    domnamespace-1.*: misc tests
#    domnamespace-2.*: moving namespaced nodes from one document to another
#    domnamespace-3.*: moving namespaced nodes within a document
#    domnamespace-4.*: createNodeCmd and namespaces
#
# Copyright (c) 2002 Rolf Ade.
#
# RCS: @(#) $Id$

source [file join [file dir [info script]] loadtdom.tcl]

................................................................................
    set newParent [$doc selectNodes {/doc/node()[2]}]
    $newParent appendChild $nodeToMove
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<doc><e xmlns="foo"/><e xmlns="bar"><ee xmlns="foo"/></e></doc>}


namespace eval nodeCmds {
    dom createNodeCmd -namespace foo.bar elementNode ns1:e1
    dom createNodeCmd -namespace foo.bar elementNode e1
    dom createNodeCmd textNode t
    dom createNodeCmd -tagName e1 elementNode e1NoNS
}

test domnamespace-4.1 {createNodeCmd and namespace} {
    dom createDocument doc doc
    $doc documentElement root
    $root appendFromScript {
        nodeCmds::ns1:e1 {nodeCmds::t "this"}
    }
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<doc><ns1:e1 xmlns:ns1="foo.bar">this</ns1:e1></doc>}

test domnamespace-4.2 {createNodeCmd and namespace} {
    dom createDocumentNS foo.bar ns1:doc doc
    $doc documentElement root
    $root appendFromScript {
        nodeCmds::ns1:e1 {nodeCmds::t "this"}
    }
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<ns1:doc xmlns:ns1="foo.bar"><ns1:e1>this</ns1:e1></ns1:doc>}

test domnamespace-4.3 {createNodeCmd and namespace} {
    dom createDocumentNS foo.bar doc doc
    $doc documentElement root
    $root appendFromScript {
        nodeCmds::ns1:e1 {nodeCmds::t "this"}
    }
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<doc xmlns="foo.bar"><ns1:e1 xmlns:ns1="foo.bar">this</ns1:e1></doc>}

test domnamespace-4.4 {createNodeCmd and namespace} {
    dom createDocumentNS foo.bar doc doc
    $doc documentElement root
    $root appendFromScript {
        nodeCmds::e1 {
            nodeCmds::e1NoNS att attValue {nodeCmds::t "this"}
        }
    }
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<doc xmlns="foo.bar"><e1><e1 xmlns="" att="attValue">this</e1></e1></doc>}

test domnamespace-4.5 {createNodeCmd and namespace} {
    dom createDocumentNS foo.bar doc doc
    $doc documentElement root
    $root appendFromScript {
        nodeCmds::e1 {
            nodeCmds::e1NoNS att attValue {nodeCmds::t "this"}
        }
    }
    set result [$doc selectNodes -namespaces {fb foo.bar} string(/fb:doc/fb:e1/e1/@att)]
    $doc delete
    set result
} {attValue}

    
# cleanup
::tcltest::cleanupTests
return

Deleted tests/jsonreader.test.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# Features covered: JSON parser
#
# This file contains a collection of tests for the JSON parser.
# Tested functionalities:
#    json-1.*: JSON syntax tests
#    json-2.*: Valid JSON, that could not parsed into DOM
#    json-3.*: JSON unescaping
#    json-4.*: Unicode
#    json-5.*: Max nesting
#    json-6.*: asJSON
#    json-7.*: jsonType
#    json-7.*: appendFromScript
# Copyright (c) 2017 Rolf Ade.

source [file join [file dir [info script]] loadtdom.tcl]


namespace eval nodeCmds {
    dom createNodeCmd elementNode e1
    dom createNodeCmd -jsonType ARRAY elementNode jae1
    dom createNodeCmd elementNode e2
    dom createNodeCmd commentNode c
    dom createNodeCmd textNode    t
    dom createNodeCmd -jsonType TRUE textNode true
    dom createNodeCmd -jsonType FALSE textNode false
    dom createNodeCmd -jsonType NULL textNode null
    dom createNodeCmd -jsonType NUMBER textNode number
    dom createNodeCmd cdataNode   cdata
    dom createNodeCmd piNode      pi
}

test json-1.1 {Parse JSON} {
    set doc [dom parse -json {{"a":"avalue","b":"bvalue","c":0.123}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<a>avalue</a><b>bvalue</b><c>0.123</c>"

test json-1.2 {Parse JSON} {
    set doc [dom parse -json { {"a" : [ "avalue" ] } }]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<a>avalue</a>}

test json-1.3 {Parse JSON} {
    set doc [dom parse -json {{"a":"a value","b":"1value"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<a>a value</a><b>1value</b>"

test json-1.4 {Parse JSON - nested object} {
    set doc [dom parse -json {{"a":{"aa":"aavalue","bb":"bbvalue"},"b":"bvalue","c":0.123}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<a><aa>aavalue</aa><bb>bbvalue</bb></a><b>bvalue</b><c>0.123</c>"

test json-1.5 {Parse JSON - array} {
    set doc [dom parse -json {{"a": [1,2,3,4,"abc"]}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<a>1234abc</a>"

test json-1.6 {Parse JSON - true, false, null} {
    set doc [dom parse -json {{"a":true,"b":false,"c":null,"d":"true","e":""}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<a>true</a><b>false</b><c>null</c><d>true</d><e></e>}

test json-1.7 {Parse JSON - array in nested object} {
    set doc [dom parse -json {{"a":{"aa":[1,2,3,4,"abc"]},"b":"bvalue"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<a><aa>1234abc</aa></a><b>bvalue</b>"

test json-1.8 {Parse JSON - true, false, null} {
    set doc [dom parse -json -jsonroot "JSONObject" {{"a":true,"b":false,"c":null,"d":"true","e":""}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<JSONObject><a>true</a><b>false</b><c>null</c><d>true</d><e></e></JSONObject>}

test json-1.9 {JSON syntax error} {
    set result [catch {dom parse -json {{"a" "a value"}}} errMsg]
    list $result $errMsg
} {1 {error "JSON syntax error" at position 5
"{"a" " <--Error-- a value"}"}}

test json-1.10 {JSON syntax error} {
    set result [catch {dom parse -json {{"a":00.23}}} errMsg]
    list $result $errMsg
} {1 {error "JSON syntax error" at position 6
"{"a":00 <--Error-- .23}"}}

test json-1.11 {JSON syntax error} {
    set result [catch {dom parse -json {{"a":-00.23}}} errMsg]
    list $result $errMsg
} {1 {error "JSON syntax error" at position 7
"{"a":-00 <--Error-- .23}"}}

test json-1.12 {JSON syntax error} {
    set result [catch {dom parse -json {{"a":.23}}} errMsg]
    list $result $errMsg
} {1 {error "JSON syntax error" at position 5
"{"a":. <--Error-- 23}"}}

test json-1.13 {JSON syntax error} {
    set result [catch {dom parse -json {{"a":-.23}}} errMsg]
    list $result $errMsg
} {1 {error "JSON syntax error" at position 6
"{"a":-. <--Error-- 23}"}}

test json-1.14 {JSON syntax error} {
    set result [catch {dom parse -json {{"a":-}}} errMsg]
    list $result $errMsg
} {1 {error "JSON syntax error" at position 5
"{"a":- <--Error-- }"}}

test json-1.15 {Parse JSON - nested object} {
    set doc [dom parse -json {["a",["aa","bb"],"b"]}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "a<arraycontainer>aabb</arraycontainer>b"

set notJsons {
    {{null}}
    {{1.23}}
    {{"string"}}
    {{"e":}}
}
test json-1.16 {Invalid input} {
    set result ""
    set ind 0
    foreach notJson $notJsons {
        if {![catch {dom parse -json $notJson docNode} errMsg]} {
            lappend result $errMsg
        }
    }
    set result
} ""

test json-1.17 {Literal binary 0 (NUL, '\0') is not allowed in input} {
    catch {dom parse -json "\"a\u0000\""}
} 1

test json-1.18 {Escaped binary 0 (NUL, '\0') is OK} {
    dom parse -json "\"a\\u0000\"" doc
    set result [$doc asJSON]
    $doc delete
    set result
} "\"a\\u0000\""

test json-1.19 {Invalid input - uncompled \u escape} {
    catch {dom parse -json {"ab\u00"}}
} 1

test json-1.20 {Escaped binary 0} {
    dom parse -json "\"a\\u0000\"" doc
    set textvalue [$doc selectNodes string(node())]
    set result [string length $textvalue]
    binary scan $textvalue c2 result2
    lappend result {*}$result2
    $doc delete
    set result
} {2 97 0}

test json-2.1 {invalid xml name} {
    set doc [dom parse -json {{"a":"a value","1b":"1value", "a\nb":"a\nb", "":"empty string"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<a>a value</a><1b>1value</1b><a
b>a
b</a
b><>empty string</>}

test json-3.1 {Unescaping} {
    set doc [dom parse -json {{"a":"a\nvalue","b":"value\tvalue"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<a>a
value</a><b>value\tvalue</b>"

test json-3.2 {Unescaping} {
    set doc [dom parse -json {{"a":"a\nvalue", "b":"12\u0077\u2221ec"}}]
    set result [$doc asXML -indent none -escapeNonASCII]
    $doc delete
    set result
} "<a>a
value</a><b>12w&#8737;ec</b>"

test json-3.3 {Unescaping} {
    set doc [dom parse -json {{"a":"\u0077\u2221"}}]
    set result [$doc asXML -indent none -escapeNonASCII]
    $doc delete
    set result
} "<a>w&#8737;</a>"

test json-3.4 {unescaping} {
    set doc [dom parse -jsonroot json -json {["\\a"]}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<json>\a</json>}

test json-3.4.1 {unescaping} {
    set doc [dom parse -jsonroot json -json {["\\a","\u0071"]}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<json>\aq</json>}

test json-3.5 {unescaping} {
    set result [catch {dom parse -json {{"this":"a\lb"}}} errMsg]
    list $result $errMsg
} {1 {error "JSON syntax error" at position 11
"{"this":"a\l <--Error-- b"}"}}

test json-3.6 {unescaping} {
    set doc [dom parse -json {{"this":"a\nbc"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<this>a
bc</this>} 

test json-3.7 {unescaping} {
    set doc [dom parse -json {{"this":"a\u0077\t\u0078bc"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<this>aw\txbc</this>"

test json-3.8 {unescaping} {
    set doc [dom parse -json {{"this":"a\u000b"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<this>a\u000b</this>"

test json-3.9 {unescaping} {
    set doc [dom parse -json {{"this":"a\u0077","that":"\t\u0078bc"}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} "<this>aw</this><that>\txbc</that>"

test json-5.1 {-jsonmaxnesting 0} {
    set result [catch {dom parse -json -jsonmaxnesting 0 {{"this":"that"}}} errMsg]
    list $result $errMsg
} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 0
"{ <--Error-- "this":"that"}"}}

test json-5.2 {-jsonmaxnesting 0} {
    set result [catch {dom parse -json -jsonmaxnesting 0 {["this","that"]}} errMsg]
    list $result $errMsg
} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 0
"[ <--Error-- "this","that"]"}}

test json-5.3 {-jsonmaxnesting 0} {
    set result [catch {dom parse -jsonroot o -json -jsonmaxnesting 0 {["this","that"]}} errMsg]
    list $result $errMsg
} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 0
"[ <--Error-- "this","that"]"}}

test json-5.4 {-jsonmaxnesting} {
    set doc [dom parse -json -jsonmaxnesting 2 {{"this":{"foo":"that"}}}]
    set result [$doc asXML -indent none]
    $doc delete
    set result
} {<this><foo>that</foo></this>}

test json-5.5 {-jsonmaxnesting} {
    set result [catch {dom parse -json -jsonmaxnesting 1 \
                           {{"this":{"foo":"that"}}}} errMsg]
    list $result $errMsg
} {1 {error "Maximum JSON object/array nesting depth exceeded" at position 8
"{"this":{ <--Error-- "foo":"that"}}"}}

test json-5.6 {-jsonmaxnesting} {
    set doc [dom parse -json -jsonmaxnesting 2 {
        {
            "this": {
                "foo":"that",
                "bar":"grill"
            },
            "two": "value",
            "three": {
                "t1":"t1value",
                "t2":"t2value"
            },
            "four": ["a","b","c"]
        }}]
    set result [$doc asXML]
    $doc delete
    set result
} {<this>
    <foo>that</foo>
    <bar>grill</bar>
</this>
<two>value</two>
<three>
    <t1>t1value</t1>
    <t2>t2value</t2>
</three>
<four>abc</four>
}

set jsons {
    {{"a":"avalue","b":"bvalue","c":0.123}}
    {{"a":["avalue"]}}
    {{"a":"a value","b":"1value"}}
    {{"a":{"aa":"aavalue","bb":"bbvalue"},"b":"bvalue","c":0.123}}
    {{"a":[1,2,3,4,"abc"]}}
    {{"a":true,"b":false,"c":null,"d":"true","e":""}}
    {{"a":{"aa":[1,2,3,4,"abc"]},"b":"bvalue"}}
    {{"a":true,"b":false,"c":null,"d":"true","e":""}}
    {["a",["aa","bb"],"b"]}
    {{"a":"a\nvalue","b":"value\tvalue"}}
    {["\\\\a"]}
    {["a\"b"]}
    {{"b":"a \"b c\" d","b":"a \"b c\" d"}}
    {{"this":"a\nbc"}}
    {{"this":{"foo":"that"}}}
    {{"this":{"foo":"that","bar":"grill"},"two":"value","three":{"t1":"t1value","t2":"t2value"},"four":["a","b","c"]}}
    {"only a string"}
    {null}
    {1.23}
    {true}
    {false}
    {{}}
    {[]}
    {[[]]}
    {[["x"]]}
    {""}
    {[[[[["a"]]]]]}
    {{"x":[{"id":"foo"}]}}
    {"http://foo.bar"}
}
test json-6.1 {asJSON} {
    set failedlist [list]
    set ind 0
    foreach json $jsons {
        set doc [dom parse -json $json]
        set out [$doc asJSON]
        if {$json ne $out} {
            lappend failedlist "$ind : '$json' : '$out'"
        }
        incr ind
    }
    set failedlist
} {}

test json-6.2 {asJSON - slash will not be escaped while serializing} {
    set doc [dom parse -json {"http:\/\/foo.bar"}]
    set result [$doc asJSON]
    $doc delete
    set result
} {"http://foo.bar"}

test json-6.3 {asJSON - docNode serialization} {
    dom createDocumentNode docNode
    set result [$docNode asJSON]
    $docNode delete
    set result
} {{}}

test json-6.4 {asJSON - doc serialization} {
    dom createDocument root docNode
    set result [$docNode asJSON]
    $docNode delete
    set result
} {{"root":""}}

test json-6.5 {asJSON - serialization of control characters} {
    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\""]
    set result [$doc asJSON]
    $doc delete
    set result
} {"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"}

test json-7.1 {jsonType} {
    set doc [dom parse {<j>foo</j>}]
    set root [$doc documentElement]
    set result [list]
    lappend result [$root asJSON]
    lappend result [$root jsonType]
    $root jsonType ARRAY
    lappend result [$root asJSON]
    $doc delete
    set result
} {{"foo"} NONE {["foo"]}}

test json-7.2 {jsonType} {
    set doc [dom createDocumentNode]
    set result [$doc jsonType]
    lappend result [$doc asJSON]
    lappend result [catch {$doc jsonType foo}]
    $doc jsonType ARRAY
    lappend result [$doc asJSON]
    $doc jsonType OBJECT
    lappend result [$doc asJSON]
    $doc delete
    set result
} {NONE {{}} 1 {[]} {{}}}

test json-8.1 {appendFromScript} {
    set doc [dom createDocumentNode]
    $doc appendFromScript {
        nodeCmds::e1
    }
    set result [list]
    lappend result [$doc asJSON]
    set root [$doc documentElement]
    lappend result [$root asJSON]
    $doc removeChild [$doc firstChild]
    $doc appendFromScript {
        nodeCmds::jae1
    }
    lappend result [$doc asJSON]
    set root [$doc documentElement]
    lappend result [$root asJSON]
    lappend result [$root jsonType]
    $doc delete
    set result
} {{{"e1":""}} {{}} {{"jae1":[]}} {[]} ARRAY}

test json-8.2 {appendFromScript} {
    set doc [dom createDocumentNode]
    $doc appendFromScript {
        nodeCmds::t "some string"
    }
    set result [$doc asJSON]
    $doc delete
    set result
} {"some string"}

test json-8.3 {appendFromScript} {
    set doc [dom createDocumentNode]
    $doc appendFromScript {
        nodeCmds::t ""
        nodeCmds::true ""
        nodeCmds::false ""
        nodeCmds::null ""
    }
    set result [$doc asJSON]
    $doc delete
    set result
} {["",true,false,null]}

test json-8.4 {appendFromScript - text node with type NUMBER} {
    set doc [dom createDocumentNode]
    $doc appendFromScript {
        nodeCmds::number ""
        nodeCmds::number "0"
        nodeCmds::number "123456789012345678901234567890.12345679e-0003"
        nodeCmds::number "42 "
        nodeCmds::number " 42"
        nodeCmds::number "-"
    }
    set result [$doc asJSON]
    $doc delete
    set result
} {["",0,123456789012345678901234567890.12345679e-0003,"42 "," 42","-"]}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Changes to tests/loadtdom.tcl.

4
5
6
7
8
9
10
11
12
13
14
15
16
# the tcltest package and the lastest tdom build is present.
#
# RCS: @(#) $Id$
#

package require tcltest
namespace import ::tcltest::*
package require -exact tdom 0.8.3
if {[lsearch [namespace children] ::tDOM] == -1} {
    # tcldomsh without the script library. Source the lib.
    source [file join [file dir [info script]] ../lib tdom.tcl]
}








|





4
5
6
7
8
9
10
11
12
13
14
15
16
# the tcltest package and the lastest tdom build is present.
#
# RCS: @(#) $Id$
#

package require tcltest
namespace import ::tcltest::*
package require -exact tdom 0.9.0
if {[lsearch [namespace children] ::tDOM] == -1} {
    # tcldomsh without the script library. Source the lib.
    source [file join [file dir [info script]] ../lib tdom.tcl]
}

Changes to tests/xpath.test.

544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
....
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090

test xpath-5.1 {erroneous XPath expr: missing right brace in predicate} {
    set result [catch {$root selectNodes {*[1}} errMsg]
    list $result $errMsg
} {1 {Predicate: Expected "RBRACKET" for '*[1' 

Parsed symbols:
     0 WCARDNAME        0 0.000e+00     0  *
     1 LBRACKET         0 0.000e+00     1  
     2 INTNUMBER        1 1.000e+00     2  }}

test xpath-5.2 {erroneous XPath expr: missing right brace in predicate} {
    set result [catch {$root selectNodes {*[1][@attr}} errMsg]
    list $result $errMsg
} {1 {Predicate: Expected "RBRACKET" for '*[1][@attr' 

Parsed symbols:
     0 WCARDNAME        0 0.000e+00     0  *
     1 LBRACKET         0 0.000e+00     1  
     2 INTNUMBER        1 1.000e+00     2  
     3 RBRACKET         0 0.000e+00     3  
     4 LBRACKET         0 0.000e+00     4  
     5 ATTRIBUTE        0 0.000e+00     9  attr}}

test xpath-5.3 {erroneous XPath expr: missing left brace in predicate} {
    catch {$root selectNodes {*1]}}
} {1}

test xpath-5.4 {erroneous XPath expr} {
    catch {$root selectNodes {myNS: bar}} errMsg
................................................................................
    set result [catch {$doc selectNodes {a[b %nodeName='another value']}} errMsg]
    lappend result $errMsg
    $doc delete
    set result
} {1 {Predicate: Expected "RBRACKET" for 'a[b %nodeName='another value']' 

Parsed symbols:
     0 WCARDNAME        0 0.000e+00     0  a
     1 LBRACKET         0 0.000e+00     1  
     2 WCARDNAME        0 0.000e+00     2  b
-->  3 WCARDNAME        1 0.000e+00    12  with spaces
     4 EQUAL            0 0.000e+00    13  
     5 LITERAL          0 0.000e+00    28  another value
     6 RBRACKET         0 0.000e+00    29  }}

test xpath-5.47 {Element name injected with tcl variable} {
    set doc [dom parse -json {{"a":{"":"the value"},"a":{"":"another value"}}}]
    set nodeName ""
    set node [$doc selectNodes {a[%nodeName='another value']}]
    set result [list]
    lappend result [$node nodeName]







|
|
|







|
|
|
|
|
|







 







|
|
|
|
|
|
|







544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
....
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090

test xpath-5.1 {erroneous XPath expr: missing right brace in predicate} {
    set result [catch {$root selectNodes {*[1}} errMsg]
    list $result $errMsg
} {1 {Predicate: Expected "RBRACKET" for '*[1' 

Parsed symbols:
     0 WCARDNAME        0 00000.000     0  *
     1 LBRACKET         0 00000.000     1  
     2 INTNUMBER        1 00001.000     2  }}

test xpath-5.2 {erroneous XPath expr: missing right brace in predicate} {
    set result [catch {$root selectNodes {*[1][@attr}} errMsg]
    list $result $errMsg
} {1 {Predicate: Expected "RBRACKET" for '*[1][@attr' 

Parsed symbols:
     0 WCARDNAME        0 00000.000     0  *
     1 LBRACKET         0 00000.000     1  
     2 INTNUMBER        1 00001.000     2  
     3 RBRACKET         0 00000.000     3  
     4 LBRACKET         0 00000.000     4  
     5 ATTRIBUTE        0 00000.000     9  attr}}

test xpath-5.3 {erroneous XPath expr: missing left brace in predicate} {
    catch {$root selectNodes {*1]}}
} {1}

test xpath-5.4 {erroneous XPath expr} {
    catch {$root selectNodes {myNS: bar}} errMsg
................................................................................
    set result [catch {$doc selectNodes {a[b %nodeName='another value']}} errMsg]
    lappend result $errMsg
    $doc delete
    set result
} {1 {Predicate: Expected "RBRACKET" for 'a[b %nodeName='another value']' 

Parsed symbols:
     0 WCARDNAME        0 00000.000     0  a
     1 LBRACKET         0 00000.000     1  
     2 WCARDNAME        0 00000.000     2  b
-->  3 WCARDNAME        1 00000.000    12  with spaces
     4 EQUAL            0 00000.000    13  
     5 LITERAL          0 00000.000    28  another value
     6 RBRACKET         0 00000.000    29  }}

test xpath-5.47 {Element name injected with tcl variable} {
    set doc [dom parse -json {{"a":{"":"the value"},"a":{"":"another value"}}}]
    set nodeName ""
    set node [$doc selectNodes {a[%nodeName='another value']}]
    set result [list]
    lappend result [$node nodeName]

Changes to tests/xslt.test.

1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
    catch {$xmldoc xslt $xsltdoc resultDoc} errMsg
    $xmldoc delete
    $xsltdoc delete
    set errMsg
} {The 'current' function is not allowed in Pattern. for '*[current() != 'notthis']' 

Parsed symbols:
     0 WCARDNAME        0 0.000e+00     0  *
     1 LBRACKET         0 0.000e+00     1  
     2 FUNCTION         0 0.000e+00     8  current
     3 LPAR             0 0.000e+00     9  
     4 RPAR             0 0.000e+00    10  
     5 NOTEQ            0 0.000e+00    13  
     6 LITERAL          0 0.000e+00    23  notthis
     7 RBRACKET         0 0.000e+00    24  }

set xslt-8.2.xml {<?xml version="1.0"?>
<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">
	<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
	</DocumentProperties>
	<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
	</OfficeDocumentSettings>







|
|
|
|
|
|
|
|







1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
    catch {$xmldoc xslt $xsltdoc resultDoc} errMsg
    $xmldoc delete
    $xsltdoc delete
    set errMsg
} {The 'current' function is not allowed in Pattern. for '*[current() != 'notthis']' 

Parsed symbols:
     0 WCARDNAME        0 00000.000     0  *
     1 LBRACKET         0 00000.000     1  
     2 FUNCTION         0 00000.000     8  current
     3 LPAR             0 00000.000     9  
     4 RPAR             0 00000.000    10  
     5 NOTEQ            0 00000.000    13  
     6 LITERAL          0 00000.000    23  notthis
     7 RBRACKET         0 00000.000    24  }

set xslt-8.2.xml {<?xml version="1.0"?>
<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">
	<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
	</DocumentProperties>
	<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
	</OfficeDocumentSettings>

Added win/README.



























































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
This file contains instructions for building tdom on Windows platforms.

Windows builds may be done with either the MingW-W64 tool chain
comprising of gcc and friends, or with the Microsoft Visual C++ and
nmake tools. Each is described below.

IMPORTANT NOTE:
Building with either tool chain requires that the Tcl libraries that
are linked have also been built with the same tool chain. The resulting
binaries however can be loaded into a Tcl shell compiled with any
tool chain provided the requisite C runtimes are present on the system.

Building With The Mingw-W64 Tool Chain
======================================

Building with the MingW follows a similar process to the autoconf/TEA
based Unix builds.

1. Start a shell using mingw32.exe or mingw64.exe for 32- and 64-bit
fields respectively. Do NOT use msys2.exe directly.

2. Assuming you want to include HTML5 support using the Gumbo libraries,
build the Gumbo libraries by running these commands in the top level
directory where you extracted the Gumbo distribution. Note these
shell commands must be run in the mingw32.exe or mingw64.exe shells
as appropriate.

    ./autogen.sh
    ./configure
    make
    make install

This will install the Gumbo libraries in the mingw32/mingw64 system
directories as appropriate.

3. Change to a build directory and run the configure at the top level
tdom directory. For example, if doing a 64-bit build in the win/build64
directory within a mingw64.exe shell,

    mkdir win/build
    cd win/build
    ../../configure --enable-threads --enable-html5 --enable-64bit --prefix=/c/tcl/mingw/85/x64 --with-tcl=/c/tcl/mingw/85/x64/lib
    make
    make install

In the above sequence, we are building against Tcl 8.5 installed under
c:\tcl\mingw\85\x64 on the system. The Gumbo libraries built in the
previous step are automatically picked up from the mingw64.exe directories.
Note that tdom on Windows binds against the static Gumbo library so
there is no additional DLL to distribute.

The 32-bit build is similar except omitting the --enable-64bit option
(and of course pointing configure to a 32-bit installation of Tcl.

4. Build the tnc and tdomhtml extensions in similar fashion to the above
except that the --enable-html5 option should be left out in both cases,
and an additional option --with-tdom=path/to/tdom/build needs to be
specified for the tnc configure step.

IMPORTANT NOTE:
Because the MinGW-built binaries link to the msvcrt 6.0 runtimes that
is present on all Windows systems, the built tdom is usable on all
Windows systems with a Tcl built with any tool chain without needing
additional runtime libraries to be installed.




Building with Visual Studio 2017 Community Edition (free)
=========================================================

1. Build the Gumbo libraries if HTML5 support is desired.

1a. Check out the git repository from
https://github.com/apnadkarni/gumbo-parser.  Do NOT use the original
Gumbo repository as that does not contain a complete Visual Studio
project file required for tdom.

1b. Switch to the tdom-libs branch.
Open the visualc/gumbo.sln solution file in Visual Studio. Click the
Batch Build... item under the Build menu. In the dialog box, select
the Win32|Release|x86 and x64|Release|x64 project configurations and
then click the Build or Rebuild button. This will build the 32-bit
and 64-bit gumbo.lib libraries under visualc/Win32/Release and
visualc/x64/Release respectively.

2. Next start a Visual Studio build command shell for 64-bit builds,
usually from
    Windows Start menu->Visual Studio 2017 Folder->x64 Native Command shell

3. Change to the tdom\win directory and type the command

    nmake /s /nologo /f makefile.vc INSTALLDIR=c:\tcl\85-vs2017\x64 GUMBODIR=C:\src\gumbo
    nmake /s /nologo /f makefile.vc INSTALLDIR=c:\tcl\85-vs2017\x64 GUMBODIR=C:\src\gumbo install

Here INSTALLDIR is the path to your Tcl installation and GUMBODIR is
the path to the top level of the Gumbo sources. If GUMBODIR is not
specified, tdom will build without HTML5 support.

The 32-bit builds are similar except that

- the commands need to be run from the Visual Studio x86 Native Tools
command shell, and
- the INSTALLDIR needs to point to a 32-bit Tcl installation
- (Note GUMBODIR need not change)

4a. To build the tnc and tdomhtml extensions,

    cd extensions/tnc/win
    nmake /s /nologo /f makefile.vc INSTALLDIR=c:\tcl\85-vs2017\x64
    nmake /s /nologo /f makefile.vc INSTALLDIR=c:\tcl\85-vs2017\x64 install

    cd extensions/tdomhtml/win
    nmake /s /nologo /f makefile.vc INSTALLDIR=c:\tcl\85-vs2017\x64 install

Note no build step necessary for tdomhtml as it is pure Tcl.

Similar steps for 32-bit builds with appropriate changes.

IMPORTANT NOTE:
The Visual Studio 2017 runtimes are not guaranteed to be installed on
all Windows systems. Thus the built tdom package should only be used
with a Tcl that is also built with Visual Studio 2017.



# Building with Visual C++ 6 (32-bit) or Windows 2003 SDK (for 64-bit)
======================================================================

Steps similar to above except that HTML5 support is not available due
to Gumbo needing C99 support. The GUMBODIR option should be left out
on the nmake build commands.

IMPORTANT NOTE:
Because the VC++ 6 and 2003 SDK link to the msvcrt 6.0 runtimes that
is present on all Windows systems, the built tdom is usable on all
Windows systems with a Tcl built with any tool chain without needing
additional runtime libraries to be installed.



Changes to win/makefile.vc.

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176

177
178
179
180
181
182
183
...
217
218
219
220
221
222
223

224
225
226
227
228
229
230
...
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
...
268
269
270
271
272
273
274
275
276
277




278
279
280
281
282
283
284
...
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
...
322
323
324
325
326
327
328








329
330
331
332
333
334
335
...
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
...
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
...
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
# binary here.
#
#-------------------------------------------------------------------------

PROJECT = tdom
!include "rules.vc"

DOTVERSION      = 0.8.4
VERSION         = $(DOTVERSION:.=)
STUBPREFIX      = $(PROJECT)stub

DLLOBJS = \
	$(TMP_DIR)\xmlrole.obj     \
	$(TMP_DIR)\xmltok.obj      \
	$(TMP_DIR)\xmlparse.obj    \
	$(TMP_DIR)\xmlsimple.obj   \
	$(TMP_DIR)\utf8conv.obj    \
	$(TMP_DIR)\dom.obj         \
	$(TMP_DIR)\domalloc.obj    \
	$(TMP_DIR)\domhtml.obj     \

	$(TMP_DIR)\domxslt.obj     \
	$(TMP_DIR)\nodecmd.obj     \
	$(TMP_DIR)\domxpath.obj    \
	$(TMP_DIR)\domlock.obj     \
	$(TMP_DIR)\domjson.obj     \
	$(TMP_DIR)\tclexpat.obj    \
	$(TMP_DIR)\tcldom.obj      \
................................................................................
GENERICDIR	= $(ROOT)\generic
WINDIR		= $(ROOT)\win
LIBDIR          = $(ROOT)\lib
DOCDIR		= $(ROOT)\doc
TOOLSDIR	= $(ROOT)\tools
COMPATDIR	= $(ROOT)\compat
EXPATDIR        = $(ROOT)\expat


#---------------------------------------------------------------------
# Compile flags
#---------------------------------------------------------------------

!if !$(DEBUG)
!if $(OPTIMIZING)
................................................................................
### Warnings are too many, can't support warnings into errors.
cdebug	= -Zi -Od $(DEBUGFLAGS)
!else
cdebug	= -Zi -WX $(DEBUGFLAGS)
!endif

### Declarations common to all compiler options
cwarn = -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE
cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\

# Warning level
!if $(FULLWARNINGS)
cflags = $(cflags) -W4
!else
cflags = $(cflags) -W3
!endif

!if $(MSVCRT)
!if $(DEBUG) && !$(UNCHECKED)
crt = -MDd
!else
crt = -MD
!endif
................................................................................
!if !$(STATIC_BUILD)
cflags = $(cflags) -DUSE_TCL_STUBS
!if defined(TKSTUBLIB)
cflags = $(cflags) -DUSE_TK_STUBS
!endif
!endif

DEFS            =-DHAVE_MEMMOVE -DXML_DTD -DXML_NS -DTDOM_NO_UNKNOWN_CMD
DEFS_EXPAT	=-DXMLIMPORT=__declspec(dllexport)
INCLUDES	= -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(EXPATDIR)" $(TCL_INCLUDES) 




BASE_CFLAGS	= $(cflags) $(cdebug) $(crt) $(INCLUDES)
CON_CFLAGS	= $(cflags) $(cdebug) $(crt) -DCONSOLE
TCL_CFLAGS      = -DPACKAGE_NAME="\"$(PROJECT)\"" \
		  -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \
		  $(BASE_CFLAGS) $(OPTDEFINES) $(DEFS) $(DEFS_EXPAT)

#---------------------------------------------------------------------
................................................................................
!else
ldebug	= -release -opt:ref -opt:icf,3
!endif

### Declarations common to all linker options
lflags	= -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)

!if $(FULLWARNINGS)
lflags = $(lflags) -warn:3
!endif

!if $(PROFILE)
lflags	= $(lflags) -profile
!endif

!if $(ALIGN98_HACK) && !$(STATIC_BUILD)
### Align sections for PE size savings.
lflags	= $(lflags) -opt:nowin98
................................................................................
guilflags = $(lflags) -subsystem:windows
!if !$(STATIC_BUILD)
baselibs  = $(TCLSTUBLIB)
!if defined(TKSTUBLIB)
baselibs  = $(baselibs) $(TKSTUBLIB)
!endif
!endif









# Avoid 'unresolved external symbol __security_cookie' errors.
# c.f. http://support.microsoft.com/?id=894573
!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
baselibs   = $(baselibs) bufferoverflowU.lib
!endif

................................................................................
$**
<<
	$(_VC_MANIFEST_EMBED_DLL)
	-@del $*.exp
!endif

$(PRJSTUBLIB): $(PRJSTUBOBJS)
	$(lib32) -nologo -out:$@ $(PRJSTUBOBJS)

#---------------------------------------------------------------------
# Implicit rules
#---------------------------------------------------------------------

{$(WINDIR)}.c{$(TMP_DIR)}.obj::
    $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
................................................................................
.SUFFIXES:.c .rc

#-------------------------------------------------------------------------
# Explicit dependency rules
#
#-------------------------------------------------------------------------

$(OUT_DIR)\pkgIndex.tcl: $(ROOT)\pkgIndex.tcl.in
	nmakehlp -s << $** > $@
@PACKAGE_VERSION@    $(DOTVERSION)
@PACKAGE_NAME@       $(PROJECT)
@PKG_LIB_FILE@       $(PRJLIBNAME)
<<

#---------------------------------------------------------------------
# Installation. (EDIT)
#
# You may need to modify this section to reflect the final distribution
# of your files and possibly to generate documentation.
#
................................................................................
	@$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" >NUL

install-libraries:
        @echo Installing libraries to '$(SCRIPT_INSTALL_DIR)'
        @if exist $(LIBDIR)\NUL $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)" >NUL
        @echo Installing package index in '$(SCRIPT_INSTALL_DIR)'
        @type << >"$(SCRIPT_INSTALL_DIR)\pkgIndex.tcl"
if {[info exists ::tcl_platform(debug)]} {
    package ifneeded $(PROJECT) $(DOTVERSION) "[list load [file join $$dir $(PROJECT)$(VERSION)g.$(EXT)] tdom]; [list source [file join $$dir tdom.tcl]]"
} else {
    package ifneeded $(PROJECT) $(DOTVERSION) "[list load [file join $$dir $(PROJECT)$(VERSION).$(EXT)] tdom]; [list source [file join $$dir tdom.tcl]]"
}
<<

install-docs:
#	@echo Installing documentation files to '$(DOC_INSTALL_DIR)'
#	@if exist $(DOCDIR) $(CPY) $(DOCDIR)\*.n "$(DOC_INSTALL_DIR)"

#---------------------------------------------------------------------
# Clean up
#---------------------------------------------------------------------

clean:
	@if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
	@if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc
	@if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i
	@if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x
	@if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch

realclean: clean
	@if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR)

distclean: realclean
	@if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
	@if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj







|












>







 







>







 







|


|
|
|
<
|
<







 







|

|
>
>
>
>







 







<
<
<
<







 







>
>
>
>
>
>
>
>







 







|







 







<
<
<
<
<
<







 







<
<
<
|
<












|










157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
...
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
...
239
240
241
242
243
244
245
246
247
248
249
250
251

252

253
254
255
256
257
258
259
...
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
...
297
298
299
300
301
302
303




304
305
306
307
308
309
310
...
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
...
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
...
449
450
451
452
453
454
455






456
457
458
459
460
461
462
...
469
470
471
472
473
474
475



476

477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
# binary here.
#
#-------------------------------------------------------------------------

PROJECT = tdom
!include "rules.vc"

DOTVERSION      = 0.9.0
VERSION         = $(DOTVERSION:.=)
STUBPREFIX      = $(PROJECT)stub

DLLOBJS = \
	$(TMP_DIR)\xmlrole.obj     \
	$(TMP_DIR)\xmltok.obj      \
	$(TMP_DIR)\xmlparse.obj    \
	$(TMP_DIR)\xmlsimple.obj   \
	$(TMP_DIR)\utf8conv.obj    \
	$(TMP_DIR)\dom.obj         \
	$(TMP_DIR)\domalloc.obj    \
	$(TMP_DIR)\domhtml.obj     \
	$(TMP_DIR)\domhtml5.obj    \
	$(TMP_DIR)\domxslt.obj     \
	$(TMP_DIR)\nodecmd.obj     \
	$(TMP_DIR)\domxpath.obj    \
	$(TMP_DIR)\domlock.obj     \
	$(TMP_DIR)\domjson.obj     \
	$(TMP_DIR)\tclexpat.obj    \
	$(TMP_DIR)\tcldom.obj      \
................................................................................
GENERICDIR	= $(ROOT)\generic
WINDIR		= $(ROOT)\win
LIBDIR          = $(ROOT)\lib
DOCDIR		= $(ROOT)\doc
TOOLSDIR	= $(ROOT)\tools
COMPATDIR	= $(ROOT)\compat
EXPATDIR        = $(ROOT)\expat


#---------------------------------------------------------------------
# Compile flags
#---------------------------------------------------------------------

!if !$(DEBUG)
!if $(OPTIMIZING)
................................................................................
### Warnings are too many, can't support warnings into errors.
cdebug	= -Zi -Od $(DEBUGFLAGS)
!else
cdebug	= -Zi -WX $(DEBUGFLAGS)
!endif

### Declarations common to all compiler options
cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE
cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\

# TBD - some of the code, like expat checks for Windows using the
# WIN32 macro. This should really be changed to check _WIN32. For now,
# define WIN32 ourselves

cflags = $(cflags) -DWIN32


!if $(MSVCRT)
!if $(DEBUG) && !$(UNCHECKED)
crt = -MDd
!else
crt = -MD
!endif
................................................................................
!if !$(STATIC_BUILD)
cflags = $(cflags) -DUSE_TCL_STUBS
!if defined(TKSTUBLIB)
cflags = $(cflags) -DUSE_TK_STUBS
!endif
!endif

DEFS            =-DHAVE_MEMMOVE=1 -DXML_DTD=1 -DXML_NS=1 -DTDOM_NO_UNKNOWN_CMD=1
DEFS_EXPAT	=-DXMLIMPORT=__declspec(dllexport)
INCLUDES	= -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(EXPATDIR)" $(TCL_INCLUDES)
!if "$(GUMBODIR)" != ""
DEFS     = $(DEFS) -DTDOM_HAVE_GUMBO=1
INCLUDES = $(INCLUDES) -I"$(GUMBODIR)\src"
!endif
BASE_CFLAGS	= $(cflags) $(cdebug) $(crt) $(INCLUDES)
CON_CFLAGS	= $(cflags) $(cdebug) $(crt) -DCONSOLE
TCL_CFLAGS      = -DPACKAGE_NAME="\"$(PROJECT)\"" \
		  -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \
		  $(BASE_CFLAGS) $(OPTDEFINES) $(DEFS) $(DEFS_EXPAT)

#---------------------------------------------------------------------
................................................................................
!else
ldebug	= -release -opt:ref -opt:icf,3
!endif

### Declarations common to all linker options
lflags	= -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)





!if $(PROFILE)
lflags	= $(lflags) -profile
!endif

!if $(ALIGN98_HACK) && !$(STATIC_BUILD)
### Align sections for PE size savings.
lflags	= $(lflags) -opt:nowin98
................................................................................
guilflags = $(lflags) -subsystem:windows
!if !$(STATIC_BUILD)
baselibs  = $(TCLSTUBLIB)
!if defined(TKSTUBLIB)
baselibs  = $(baselibs) $(TKSTUBLIB)
!endif
!endif

!if "$(GUMBODIR)" != ""
!if "$(MACHINE)" == "AMD64"
baselibs = $(baselibs) "$(GUMBODIR)\visualc\x64\Release\gumbo.lib"
!else
baselibs = $(baselibs) "$(GUMBODIR)\visualc\Win32\Release\gumbo.lib"
!endif
!endif

# Avoid 'unresolved external symbol __security_cookie' errors.
# c.f. http://support.microsoft.com/?id=894573
!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
baselibs   = $(baselibs) bufferoverflowU.lib
!endif

................................................................................
$**
<<
	$(_VC_MANIFEST_EMBED_DLL)
	-@del $*.exp
!endif

$(PRJSTUBLIB): $(PRJSTUBOBJS)
	$(lib32) -ltcg -nologo -out:$@ $(PRJSTUBOBJS)

#---------------------------------------------------------------------
# Implicit rules
#---------------------------------------------------------------------

{$(WINDIR)}.c{$(TMP_DIR)}.obj::
    $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
................................................................................
.SUFFIXES:.c .rc

#-------------------------------------------------------------------------
# Explicit dependency rules
#
#-------------------------------------------------------------------------








#---------------------------------------------------------------------
# Installation. (EDIT)
#
# You may need to modify this section to reflect the final distribution
# of your files and possibly to generate documentation.
#
................................................................................
	@$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" >NUL

install-libraries:
        @echo Installing libraries to '$(SCRIPT_INSTALL_DIR)'
        @if exist $(LIBDIR)\NUL $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)" >NUL
        @echo Installing package index in '$(SCRIPT_INSTALL_DIR)'
        @type << >"$(SCRIPT_INSTALL_DIR)\pkgIndex.tcl"



    package ifneeded $(PROJECT) $(DOTVERSION) "[list load [file join $$dir $(PROJECT)$(VERSION)$(SUFX).$(EXT)] tdom]; [list source [file join $$dir tdom.tcl]]"

<<

install-docs:
#	@echo Installing documentation files to '$(DOC_INSTALL_DIR)'
#	@if exist $(DOCDIR) $(CPY) $(DOCDIR)\*.n "$(DOC_INSTALL_DIR)"

#---------------------------------------------------------------------
# Clean up
#---------------------------------------------------------------------

clean:
	@if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
	@if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc
	@if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i
	@if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x
	@if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch

realclean: clean
	@if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR)

distclean: realclean
	@if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
	@if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj

Changes to win/nmakehlp.c.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19




20
21

22
23




24

25

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

42
43
44
45
46
47
48
49
50
..
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
...
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
...
153
154
155
156
157
158
159
160
161











162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
...
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
...
295
296
297
298
299
300
301
302


303
304
305
306
307

308
309
310
311
312
313
314
315

316
317
318
319
320
321
322
323
...
355
356
357
358
359
360
361


362


363
364
365
366
367
368
369
...
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
...
420
421
422
423
424
425
426
427


428
429
430
431
432
433
434
435
436
437
...
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530

531
532
533
534
535
536
537
...
541
542
543
544
545
546
547
548
549
550

551
552
553
554
555
556
557
558
559
560

561
562
563
564
565
566
567
...
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
...
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
...
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
...
696
697
698
699
700
701
702
703
704
705
706
707
708
























709
710
711
712
713
714
715
716
717
718
 *	This is used to fix limitations within nmake and the environment.
 *
 * Copyright (c) 2002 by David Gravereaux.
 * Copyright (c) 2006 by Pat Thoyts
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * ----------------------------------------------------------------------------
 * RCS: @(#) $Id$
 * ----------------------------------------------------------------------------
 */

#define _CRT_SECURE_NO_DEPRECATE
#include <windows.h>




#pragma comment (lib, "user32.lib")
#pragma comment (lib, "kernel32.lib")

#include <stdio.h>
#include <math.h>




#if defined(_M_IA64) || defined(_M_AMD64)

#pragma comment(lib, "bufferoverflowU")

#endif

/* ISO hack for dumb VC++ */
#ifdef _MSC_VER
#define   snprintf	_snprintf
#endif



/* protos */

int		CheckForCompilerFeature(const char *option);
int		CheckForLinkerFeature(const char *option);
int		IsIn(const char *string, const char *substring);
int		GrepForDefine(const char *file, const char *string);
int		SubstituteFile(const char *substs, const char *filename);

const char *    GetVersionFromFile(const char *filename, const char *match);
DWORD WINAPI	ReadFromPipe(LPVOID args);

/* globals */

#define CHUNK	25
#define STATICBUFFERSIZE    1000
typedef struct {
    HANDLE pipe;
................................................................................
			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
			&dwWritten, NULL);
		return 2;
	    }
	    return CheckForCompilerFeature(argv[2]);
	case 'l':
	    if (argc != 3) {
		chars = snprintf(msg, sizeof(msg) - 1,
	       		"usage: %s -l <linker option>\n"
			"Tests for whether link.exe supports an option\n"
			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
			&dwWritten, NULL);
		return 2;
	    }
	    return CheckForLinkerFeature(argv[2]);
	case 'f':
	    if (argc == 2) {
		chars = snprintf(msg, sizeof(msg) - 1,
			"usage: %s -f <string> <substring>\n"
			"Find a substring within another\n"
			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
................................................................................
		 * If the string is blank, there is no match.
		 */

		return 0;
	    } else {
		return IsIn(argv[2], argv[3]);
	    }
	case 'g':
	    if (argc == 2) {
		chars = snprintf(msg, sizeof(msg) - 1,
			"usage: %s -g <file> <string>\n"
			"grep for a #define\n"
			"exitcodes: integer of the found string (no decimals)\n",
			argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
			&dwWritten, NULL);
		return 2;
	    }
	    return GrepForDefine(argv[2], argv[3]);
	case 's':
	    if (argc == 2) {
		chars = snprintf(msg, sizeof(msg) - 1,
			"usage: %s -s <substitutions file> <file>\n"
			"Perform a set of string map type substutitions on a file\n"
			"exitcodes: 0\n",
			argv[0]);
................................................................................
		    "Extract a version from a file:\n"
		    "eg: pkgIndex.tcl \"package ifneeded http\"",
		    argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
		    &dwWritten, NULL);
		return 0;
	    }
	    printf("%s\n", GetVersionFromFile(argv[2], argv[3]));
	    return 0;











	}
    }
    chars = snprintf(msg, sizeof(msg) - 1,
	    "usage: %s -c|-l|-f|-g|-V ...\n"
	    "This is a little helper app to equalize shell differences between WinNT and\n"
	    "Win9x and get nmake.exe to accomplish its job.\n",
	    argv[0]);
    WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
    return 2;
}
 
int
CheckForCompilerFeature(
    const char *option)
{
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
    SECURITY_ATTRIBUTES sa;
    DWORD threadID;
................................................................................
	DWORD err = GetLastError();
	int chars = snprintf(msg, sizeof(msg) - 1,
		"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);

	FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
		FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
		(300-chars), 0);
	WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg,lstrlen(msg), &err,NULL);
	return 2;
    }

    /*
     * Close our references to the write handles that have now been inherited.
     */

................................................................................
     * Look for the commandline warning code in both streams.
     *  - in MSVC 6 & 7 we get D4002, in MSVC 8 we get D9002.
     */

    return !(strstr(Out.buffer, "D4002") != NULL
             || strstr(Err.buffer, "D4002") != NULL
             || strstr(Out.buffer, "D9002") != NULL
             || strstr(Err.buffer, "D9002") != NULL);


}
 
int
CheckForLinkerFeature(
    const char *option)

{
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
    SECURITY_ATTRIBUTES sa;
    DWORD threadID;
    char msg[300];
    BOOL ok;
    HANDLE hProcess, h, pipeThreads[2];

    char cmdline[100];

    hProcess = GetCurrentProcess();

    ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
    ZeroMemory(&si, sizeof(STARTUPINFO));
    si.cb = sizeof(STARTUPINFO);
    si.dwFlags   = STARTF_USESTDHANDLES;
................................................................................

    lstrcpy(cmdline, "link.exe -nologo ");

    /*
     * Append our option for testing.
     */



    lstrcat(cmdline, option);



    ok = CreateProcess(
	    NULL,	    /* Module name. */
	    cmdline,	    /* Command line. */
	    NULL,	    /* Process handle not inheritable. */
	    NULL,	    /* Thread handle not inheritable. */
	    TRUE,	    /* yes, inherit handles. */
................................................................................
	DWORD err = GetLastError();
	int chars = snprintf(msg, sizeof(msg) - 1,
		"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);

	FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
		FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
		(300-chars), 0);
	WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg,lstrlen(msg), &err,NULL);
	return 2;
    }

    /*
     * Close our references to the write handles that have now been inherited.
     */

................................................................................
    /*
     * Look for the commandline warning code in the stderr stream.
     */

    return !(strstr(Out.buffer, "LNK1117") != NULL ||
	    strstr(Err.buffer, "LNK1117") != NULL ||
	    strstr(Out.buffer, "LNK4044") != NULL ||
	    strstr(Err.buffer, "LNK4044") != NULL);


}
 
DWORD WINAPI
ReadFromPipe(
    LPVOID args)
{
    pipeinfo *pi = (pipeinfo *) args;
    char *lastBuf = pi->buffer;
    DWORD dwRead;
    BOOL ok;
................................................................................
    }
    lastBuf += dwRead;
    goto again;

    return 0;  /* makes the compiler happy */
}
 
int
IsIn(
    const char *string,
    const char *substring)
{
    return (strstr(string, substring) != NULL);
}
 
/*
 * Find a specified #define by name.
 *
 * If the line is '#define TCL_VERSION "8.5"', it returns 85 as the result.
 */

int
GrepForDefine(
    const char *file,
    const char *string)
{
    char s1[51], s2[51], s3[51];
    FILE *f = fopen(file, "rt");

    if (f == NULL) {
	return 0;
    }

    do {
	int r = fscanf(f, "%50s", s1);

	if (r == 1 && !strcmp(s1, "#define")) {
	    /*
	     * Get next two words.
	     */

	    r = fscanf(f, "%50s %50s", s2, s3);
	    if (r != 2) {
		continue;
	    }

	    /*
	     * Is the first word what we're looking for?
	     */

	    if (!strcmp(s2, string)) {
		double d1;

		fclose(f);

		/*
		 * Add 1 past first double quote char. "8.5"
		 */

		d1 = atof(s3 + 1);		  /*    8.5  */
		while (floor(d1) != d1) {
		    d1 *= 10.0;
		}
		return ((int) d1);		  /*    85   */
	    }
	}
    } while (!feof(f));

    fclose(f);
    return 0;
}
 
/*
 * GetVersionFromFile --
 * 	Looks for a match string in a file and then returns the version
 * 	following the match where a version is anything acceptable to
 * 	package provide or package ifneeded.
 */

const char *
GetVersionFromFile(
    const char *filename,
    const char *match)

{
    size_t cbBuffer = 100;
    static char szBuffer[100];
    char *szResult = NULL;
    FILE *fp = fopen(filename, "rt");

    if (fp != NULL) {
................................................................................

	while (fgets(szBuffer, cbBuffer, fp) != NULL) {
	    LPSTR p, q;

	    p = strstr(szBuffer, match);
	    if (p != NULL) {
		/*
		 * Skip to first digit.
		 */


		while (*p && !isdigit(*p)) {
		    ++p;
		}

		/*
		 * Find ending whitespace.
		 */

		q = p;
		while (*q && (isalnum(*q) || *q == '.')) {

		    ++q;
		}

		memcpy(szBuffer, p, q - p);
		szBuffer[q-p] = 0;
		szResult = szBuffer;
		break;
................................................................................
 *	Usage is something like:
 *	  nmakehlp -S << $** > $@
 *        @PACKAGE_NAME@ $(PACKAGE_NAME)
 *        @PACKAGE_VERSION@ $(PACKAGE_VERSION)
 *        <<
 */

int
SubstituteFile(
    const char *substitutions,
    const char *filename)
{
    size_t cbBuffer = 1024;
    static char szBuffer[1024], szCopy[1024];
    char *szResult = NULL;
................................................................................
	/*
	 * Build a list of substutitions from the first filename
	 */

	sp = fopen(substitutions, "rt");
	if (sp != NULL) {
	    while (fgets(szBuffer, cbBuffer, sp) != NULL) {
		char *ks, *ke, *vs, *ve;
		ks = szBuffer;
		while (ks && *ks && isspace(*ks)) ++ks;
		ke = ks;
		while (ke && *ke && !isspace(*ke)) ++ke;
		vs = ke;
		while (vs && *vs && isspace(*vs)) ++vs;
		ve = vs;
		while (ve && *ve && !(*ve == '\r' || *ve == '\n')) ++ve;
		*ke = 0, *ve = 0;
		list_insert(&substPtr, ks, vs);
	    }
	    fclose(sp);
	}

	/* debug: dump the list */
#ifdef _DEBUG
	{
................................................................................
	    int n = 0;
	    list_item_t *p = NULL;
	    for (p = substPtr; p != NULL; p = p->nextPtr, ++n) {
		fprintf(stderr, "% 3d '%s' => '%s'\n", n, p->key, p->value);
	    }
	}
#endif
	
	/*
	 * Run the substitutions over each line of the input
	 */
	
	while (fgets(szBuffer, cbBuffer, fp) != NULL) {
	    list_item_t *p = NULL;
	    for (p = substPtr; p != NULL; p = p->nextPtr) {
		char *m = strstr(szBuffer, p->key);
		if (m) {
		    char *cp, *op, *sp;
		    cp = szCopy;
................................................................................
		    while (*op) *cp++ = *op++;
		    *cp = 0;
		    memcpy(szBuffer, szCopy, sizeof(szCopy));
		}
	    }
	    printf(szBuffer);
	}
	
	list_free(&substPtr);
    }
    fclose(fp);
    return 0;
}

























/*
 * Local variables:
 *   mode: c
 *   c-basic-offset: 4
 *   fill-column: 78
 *   indent-tabs-mode: t
 *   tab-width: 8
 * End:
 */







<
<
<





>
>
>
>


>


>
>
>
>

>

>











|
|
|
<
|
>
|
|







 







|

|






|







 







<
<
<
<
<
<
<
<
<
<
<
<







 







|

>
>
>
>
>
>
>
>
>
>
>



|







|







 







|







 







|
>
>


|

|
>








>
|







 







>
>
|
>
>







 







|







 







|
>
>


|







 







|






<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








|


|
>







 







|


>









|
>







 







|







 







|
|








|







 







|



|







 







|





>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










5
6
7
8
9
10
11



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

48
49
50
51
52
53
54
55
56
57
58
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
...
126
127
128
129
130
131
132












133
134
135
136
137
138
139
...
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
...
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
...
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
...
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
...
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
...
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
...
465
466
467
468
469
470
471
472
473
474
475
476
477
478

























































479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
...
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
...
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
...
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
...
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
...
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
 *	This is used to fix limitations within nmake and the environment.
 *
 * Copyright (c) 2002 by David Gravereaux.
 * Copyright (c) 2006 by Pat Thoyts
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.



 * ----------------------------------------------------------------------------
 */

#define _CRT_SECURE_NO_DEPRECATE
#include <windows.h>
#define NO_SHLWAPI_GDI
#define NO_SHLWAPI_STREAM
#define NO_SHLWAPI_REG
#include <shlwapi.h>
#pragma comment (lib, "user32.lib")
#pragma comment (lib, "kernel32.lib")
#pragma comment (lib, "shlwapi.lib")
#include <stdio.h>
#include <math.h>

/*
 * This library is required for x64 builds with _some_ versions of MSVC
 */
#if defined(_M_IA64) || defined(_M_AMD64)
#if _MSC_VER >= 1400 && _MSC_VER < 1500
#pragma comment(lib, "bufferoverflowU")
#endif
#endif

/* ISO hack for dumb VC++ */
#ifdef _MSC_VER
#define   snprintf	_snprintf
#endif



/* protos */

static int CheckForCompilerFeature(const char *option);
static int CheckForLinkerFeature(const char **options, int count);
static int IsIn(const char *string, const char *substring);

static int SubstituteFile(const char *substs, const char *filename);
static int QualifyPath(const char *path);
static const char *GetVersionFromFile(const char *filename, const char *match, int numdots);
static DWORD WINAPI ReadFromPipe(LPVOID args);

/* globals */

#define CHUNK	25
#define STATICBUFFERSIZE    1000
typedef struct {
    HANDLE pipe;
................................................................................
			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
			&dwWritten, NULL);
		return 2;
	    }
	    return CheckForCompilerFeature(argv[2]);
	case 'l':
	    if (argc < 3) {
		chars = snprintf(msg, sizeof(msg) - 1,
	       		"usage: %s -l <linker option> ?<mandatory option> ...?\n"
			"Tests for whether link.exe supports an option\n"
			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
			&dwWritten, NULL);
		return 2;
	    }
	    return CheckForLinkerFeature(&argv[2], argc-2);
	case 'f':
	    if (argc == 2) {
		chars = snprintf(msg, sizeof(msg) - 1,
			"usage: %s -f <string> <substring>\n"
			"Find a substring within another\n"
			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
................................................................................
		 * If the string is blank, there is no match.
		 */

		return 0;
	    } else {
		return IsIn(argv[2], argv[3]);
	    }












	case 's':
	    if (argc == 2) {
		chars = snprintf(msg, sizeof(msg) - 1,
			"usage: %s -s <substitutions file> <file>\n"
			"Perform a set of string map type substutitions on a file\n"
			"exitcodes: 0\n",
			argv[0]);
................................................................................
		    "Extract a version from a file:\n"
		    "eg: pkgIndex.tcl \"package ifneeded http\"",
		    argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
		    &dwWritten, NULL);
		return 0;
	    }
	    printf("%s\n", GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0'));
	    return 0;
	case 'Q':
	    if (argc != 3) {
		chars = snprintf(msg, sizeof(msg) - 1,
		    "usage: %s -Q path\n"
		    "Emit the fully qualified path\n"
		    "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
		    &dwWritten, NULL);
		return 2;
	    }
	    return QualifyPath(argv[2]);
	}
    }
    chars = snprintf(msg, sizeof(msg) - 1,
	    "usage: %s -c|-f|-l|-Q|-s|-V ...\n"
	    "This is a little helper app to equalize shell differences between WinNT and\n"
	    "Win9x and get nmake.exe to accomplish its job.\n",
	    argv[0]);
    WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
    return 2;
}
 
static int
CheckForCompilerFeature(
    const char *option)
{
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
    SECURITY_ATTRIBUTES sa;
    DWORD threadID;
................................................................................
	DWORD err = GetLastError();
	int chars = snprintf(msg, sizeof(msg) - 1,
		"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);

	FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
		FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
		(300-chars), 0);
	WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL);
	return 2;
    }

    /*
     * Close our references to the write handles that have now been inherited.
     */

................................................................................
     * Look for the commandline warning code in both streams.
     *  - in MSVC 6 & 7 we get D4002, in MSVC 8 we get D9002.
     */

    return !(strstr(Out.buffer, "D4002") != NULL
             || strstr(Err.buffer, "D4002") != NULL
             || strstr(Out.buffer, "D9002") != NULL
             || strstr(Err.buffer, "D9002") != NULL
             || strstr(Out.buffer, "D2021") != NULL
             || strstr(Err.buffer, "D2021") != NULL);
}
 
static int
CheckForLinkerFeature(
    const char **options,
    int count)
{
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
    SECURITY_ATTRIBUTES sa;
    DWORD threadID;
    char msg[300];
    BOOL ok;
    HANDLE hProcess, h, pipeThreads[2];
    int i;
    char cmdline[255];

    hProcess = GetCurrentProcess();

    ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
    ZeroMemory(&si, sizeof(STARTUPINFO));
    si.cb = sizeof(STARTUPINFO);
    si.dwFlags   = STARTF_USESTDHANDLES;
................................................................................

    lstrcpy(cmdline, "link.exe -nologo ");

    /*
     * Append our option for testing.
     */

    for (i = 0; i < count; i++) {
	lstrcat(cmdline, " \"");
	lstrcat(cmdline, options[i]);
	lstrcat(cmdline, "\"");
    }

    ok = CreateProcess(
	    NULL,	    /* Module name. */
	    cmdline,	    /* Command line. */
	    NULL,	    /* Process handle not inheritable. */
	    NULL,	    /* Thread handle not inheritable. */
	    TRUE,	    /* yes, inherit handles. */
................................................................................
	DWORD err = GetLastError();
	int chars = snprintf(msg, sizeof(msg) - 1,
		"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);

	FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
		FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
		(300-chars), 0);
	WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL);
	return 2;
    }

    /*
     * Close our references to the write handles that have now been inherited.
     */

................................................................................
    /*
     * Look for the commandline warning code in the stderr stream.
     */

    return !(strstr(Out.buffer, "LNK1117") != NULL ||
	    strstr(Err.buffer, "LNK1117") != NULL ||
	    strstr(Out.buffer, "LNK4044") != NULL ||
	    strstr(Err.buffer, "LNK4044") != NULL ||
	    strstr(Out.buffer, "LNK4224") != NULL ||
	    strstr(Err.buffer, "LNK4224") != NULL);
}
 
static DWORD WINAPI
ReadFromPipe(
    LPVOID args)
{
    pipeinfo *pi = (pipeinfo *) args;
    char *lastBuf = pi->buffer;
    DWORD dwRead;
    BOOL ok;
................................................................................
    }
    lastBuf += dwRead;
    goto again;

    return 0;  /* makes the compiler happy */
}
 
static int
IsIn(
    const char *string,
    const char *substring)
{
    return (strstr(string, substring) != NULL);
}

























































 
/*
 * GetVersionFromFile --
 * 	Looks for a match string in a file and then returns the version
 * 	following the match where a version is anything acceptable to
 * 	package provide or package ifneeded.
 */

static const char *
GetVersionFromFile(
    const char *filename,
    const char *match,
    int numdots)
{
    size_t cbBuffer = 100;
    static char szBuffer[100];
    char *szResult = NULL;
    FILE *fp = fopen(filename, "rt");

    if (fp != NULL) {
................................................................................

	while (fgets(szBuffer, cbBuffer, fp) != NULL) {
	    LPSTR p, q;

	    p = strstr(szBuffer, match);
	    if (p != NULL) {
		/*
		 * Skip to first digit after the match.
		 */

		p += strlen(match);
		while (*p && !isdigit(*p)) {
		    ++p;
		}

		/*
		 * Find ending whitespace.
		 */

		q = p;
		while (*q && (strchr("0123456789.ab", *q)) && ((!strchr(".ab", *q)
			    && (!strchr("ab", q[-1])) || --numdots))) {
		    ++q;
		}

		memcpy(szBuffer, p, q - p);
		szBuffer[q-p] = 0;
		szResult = szBuffer;
		break;
................................................................................
 *	Usage is something like:
 *	  nmakehlp -S << $** > $@
 *        @PACKAGE_NAME@ $(PACKAGE_NAME)
 *        @PACKAGE_VERSION@ $(PACKAGE_VERSION)
 *        <<
 */

static int
SubstituteFile(
    const char *substitutions,
    const char *filename)
{
    size_t cbBuffer = 1024;
    static char szBuffer[1024], szCopy[1024];
    char *szResult = NULL;
................................................................................
	/*
	 * Build a list of substutitions from the first filename
	 */

	sp = fopen(substitutions, "rt");
	if (sp != NULL) {
	    while (fgets(szBuffer, cbBuffer, sp) != NULL) {
		unsigned char *ks, *ke, *vs, *ve;
		ks = (unsigned char*)szBuffer;
		while (ks && *ks && isspace(*ks)) ++ks;
		ke = ks;
		while (ke && *ke && !isspace(*ke)) ++ke;
		vs = ke;
		while (vs && *vs && isspace(*vs)) ++vs;
		ve = vs;
		while (ve && *ve && !(*ve == '\r' || *ve == '\n')) ++ve;
		*ke = 0, *ve = 0;
		list_insert(&substPtr, (char*)ks, (char*)vs);
	    }
	    fclose(sp);
	}

	/* debug: dump the list */
#ifdef _DEBUG
	{
................................................................................
	    int n = 0;
	    list_item_t *p = NULL;
	    for (p = substPtr; p != NULL; p = p->nextPtr, ++n) {
		fprintf(stderr, "% 3d '%s' => '%s'\n", n, p->key, p->value);
	    }
	}
#endif

	/*
	 * Run the substitutions over each line of the input
	 */

	while (fgets(szBuffer, cbBuffer, fp) != NULL) {
	    list_item_t *p = NULL;
	    for (p = substPtr; p != NULL; p = p->nextPtr) {
		char *m = strstr(szBuffer, p->key);
		if (m) {
		    char *cp, *op, *sp;
		    cp = szCopy;
................................................................................
		    while (*op) *cp++ = *op++;
		    *cp = 0;
		    memcpy(szBuffer, szCopy, sizeof(szCopy));
		}
	    }
	    printf(szBuffer);
	}

	list_free(&substPtr);
    }
    fclose(fp);
    return 0;
}
 
/*
 * QualifyPath --
 *
 *	This composes the current working directory with a provided path
 *	and returns the fully qualified and normalized path.
 *	Mostly needed to setup paths for testing.
 */

static int
QualifyPath(
    const char *szPath)
{
    char szCwd[MAX_PATH + 1];
    char szTmp[MAX_PATH + 1];
    char *p;
    GetCurrentDirectory(MAX_PATH, szCwd);
    while ((p = strchr(szPath, '/')) && *p)
	*p = '\\';
    PathCombine(szTmp, szCwd, szPath);
    PathCanonicalize(szCwd, szTmp);
    printf("%s\n", szCwd);
    return 0;
}

/*
 * Local variables:
 *   mode: c
 *   c-basic-offset: 4
 *   fill-column: 78
 *   indent-tabs-mode: t
 *   tab-width: 8
 * End:
 */

Changes to win/pkgIndex.tcl.

1
2
3
4
5
# tDOM Tcl package index file

package ifneeded tdom 0.8.4 \
    "[list load   [file join $dir tdom084[info sharedlibextension] ] tdom];\
     [list source [file join $dir tdom.tcl]]"


|
|

1
2
3
4
5
# tDOM Tcl package index file

package ifneeded tdom 0.9.0 \
    "[list load   [file join $dir tdom090[info sharedlibextension] ] tdom];\
     [list source [file join $dir tdom.tcl]]"

Changes to win/rules.vc.

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
..
65
66
67
68
69
70
71












































72
73
74
75
76
77
78
...
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
...
157
158
159
160
161
162
163





164
165
166
167
168
169
170
...
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213

214

215
216
217
218
219
220
221
222
223
224
225
226
227




228
229
230
231



232
233


234
235
236
237
238
239
240
241
242

243
244

245
246
247
248
249
250






251
252
253
254
255
256









257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
...
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
...
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
...
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403



404
405
406



407

408

















409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441

442
443
444
445
446
447
448



449
450
451
452
453
454
455




456
457
458
459
460
461
462
...
480
481
482
483
484
485
486






487
488
489
490


491
492
493


494

495







496
497
498
499
500
501
502
503
...
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
### Assume the normal default.
_INSTALLDIR	= C:\Program Files\Tcl
!else
### Fix the path separators.
_INSTALLDIR	= $(INSTALLDIR:/=\)
!endif

!ifndef MACHINE
!if "$(CPU)" == "" || "$(CPU)" == "i386"
MACHINE         = IX86
!else
MACHINE         = $(CPU)
!endif
!endif

!ifndef CFG_ENCODING
CFG_ENCODING	= \"cp1252\"
!endif

#----------------------------------------------------------
# Set the proper copy method to avoid overwrite questions
# to the user when copying files and selecting the right
# "delete all" method.
#----------------------------------------------------------

!if "$(OS)" == "Windows_NT"
................................................................................
CPY	= xcopy /i >_JUNK.OUT # On Win98 NUL does not work here.
COPY	= copy >_JUNK.OUT # On Win98 NUL does not work here.
RMDIR	= deltree /Y
NULL    = \NUL # Used in testing directory existence
ERRNULL = >NUL # Win9x shell cannot redirect stderr
!endif
MKDIR   = mkdir













































!message ===============================================================================

#----------------------------------------------------------
# build the helper app we need to overcome nmake's limiting
# environment.
#----------------------------------------------------------
................................................................................

!if [nmakehlp -c -RTC1]
DEBUGFLAGS     = $(DEBUGFLAGS) -RTC1
!elseif [nmakehlp -c -GZ]
DEBUGFLAGS     = $(DEBUGFLAGS) -GZ
!endif

COMPILERFLAGS  =-W3

# In v13 -GL and -YX are incompatible.
!if [nmakehlp -c -YX]
!if ![nmakehlp -c -GL]
OPTIMIZATIONS  = $(OPTIMIZATIONS) -YX
!endif
!endif
................................................................................
!if [nmakehlp -c -QIA64_Bx]
!message *** Compiler has 'B-stepping errata workarounds'
COMPILERFLAGS   = $(COMPILERFLAGS) -QIA64_Bx
!else
!message *** Compiler does not have 'B-stepping errata workarounds'
!endif
!endif






!if "$(MACHINE)" == "IX86"
### test for -align:4096, when align:512 will do.
!if [nmakehlp -l -opt:nowin98]
!message *** Linker has 'Win98 alignment problem'
ALIGN98_HACK	= 1
!else
................................................................................
!endif
!else
ALIGN98_HACK	= 0
!endif

LINKERFLAGS     =

!if [nmakehlp -l -ltcg]
LINKERFLAGS     =-ltcg
!endif

#----------------------------------------------------------
# MSVC8 (ships with Visual Studio 2005) generates a manifest
# file that we should link into the binaries. This is how.
#----------------------------------------------------------

_VC_MANIFEST_EMBED_EXE=
_VC_MANIFEST_EMBED_DLL=
VCVER=0
!if ![echo VCVERSION=_MSC_VER > vercl.x] \
    && ![cl -nologo -TC -P vercl.x $(ERRNULL)]
!include vercl.i
!if $(VCVERSION) >= 1400
VCVER=8
_VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1
_VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2
!elseif $(VCVERSION) >= 1300
VCVER=7
!elseif $(VCVERSION) >= 1200
VCVER=6
!endif
!endif

#----------------------------------------------------------
# Decode the options requested.
#----------------------------------------------------------

!if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"]
STATIC_BUILD	= 0
TCL_THREADS	= 1
DEBUG		= 0

PROFILE		= 0

MSVCRT		= 0
LOIMPACT	= 0
TCL_USE_STATIC_PACKAGES	= 0
USE_THREAD_ALLOC = 1
USE_THREAD_STORAGE = 1
UNCHECKED       = 0
!else
!if [nmakehlp -f $(OPTS) "static"]
!message *** Doing static
STATIC_BUILD	= 1
!else
STATIC_BUILD	= 0
!endif




!if [nmakehlp -f $(OPTS) "msvcrt"]
!message *** Doing msvcrt
MSVCRT		= 1
!else



MSVCRT		= 0
!endif


!if [nmakehlp -f $(OPTS) "staticpkg"]
!message *** Doing staticpkg
TCL_USE_STATIC_PACKAGES	= 1
!else
TCL_USE_STATIC_PACKAGES	= 0
!endif
!if [nmakehlp -f $(OPTS) "nothreads"]
!message *** Compile explicitly for non-threaded tcl
TCL_THREADS	= 0

!else
TCL_THREADS     = 1

!endif
!if [nmakehlp -f $(OPTS) "symbols"]
!message *** Doing symbols
DEBUG		= 1
!else
DEBUG		= 0






!endif
!if [nmakehlp -f $(OPTS) "profile"]
!message *** Doing profile
PROFILE		= 1
!else
PROFILE		= 0









!endif
!if [nmakehlp -f $(OPTS) "loimpact"]
!message *** Doing loimpact
LOIMPACT	= 1
!else
LOIMPACT	= 0
!endif
!if [nmakehlp -f $(OPTS) "thrdalloc"]
!message *** Doing thrdalloc
USE_THREAD_ALLOC = 1
!else
USE_THREAD_ALLOC = 0
!endif
!if [nmakehlp -f $(OPTS) "thrdstorage"]
!message *** Doing thrdstorage
USE_THREAD_STORAGE = 1
!else
USE_THREAD_STORAGE = 0
!endif
!if [nmakehlp -f $(OPTS) "unchecked"]
!message *** Doing unchecked
UNCHECKED = 1
!else
UNCHECKED = 0
!endif
!endif


!if !$(STATIC_BUILD)
# Make sure we don't build overly fat DLLs.
MSVCRT		= 1
# We shouldn't statically put the extensions inside the shell when dynamic.
TCL_USE_STATIC_PACKAGES = 0
!endif


#----------------------------------------------------------
# Figure-out how to name our intermediate and output directories.
# We wouldn't want different builds to use the same .obj files
# by accident.
#----------------------------------------------------------

................................................................................
#   s = static library (as opposed to an
#	import library)
#   g = linked to the debug enabled C
#	run-time.
#   x = special static build when it
#	links to the dynamic C run-time.
#----------------------------------------
SUFX	    = sgx

!if $(DEBUG)
BUILDDIRTOP = Debug
!else
BUILDDIRTOP = Release
!endif

................................................................................

TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX

!if !$(STATIC_BUILD)
TMP_DIRFULL = $(TMP_DIRFULL:Static=)
SUFX	    = $(SUFX:s=)
EXT	    = dll
!if $(MSVCRT)
TMP_DIRFULL = $(TMP_DIRFULL:X=)
SUFX	    = $(SUFX:x=)
!endif
!else
TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=)
EXT	    = lib
!if !$(MSVCRT)
TMP_DIRFULL = $(TMP_DIRFULL:X=)
SUFX	    = $(SUFX:x=)
!endif
................................................................................

#----------------------------------------------------------
# Decode the checks requested.
#----------------------------------------------------------

!if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"]
TCL_NO_DEPRECATED	    = 0
FULLWARNINGS		    = 0
!else
!if [nmakehlp -f $(CHECKS) "nodep"]
!message *** Doing nodep check
TCL_NO_DEPRECATED	    = 1
!else
TCL_NO_DEPRECATED	    = 0
!endif
!if [nmakehlp -f $(CHECKS) "fullwarn"]
!message *** Doing full warnings check
FULLWARNINGS		    = 1



!else
FULLWARNINGS		    = 0
!endif



!endif




















#----------------------------------------------------------
# Set our defines now armed with our options.
#----------------------------------------------------------

OPTDEFINES	= -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING)

!if $(TCL_MEM_DEBUG)
OPTDEFINES	= $(OPTDEFINES) -DTCL_MEM_DEBUG
!endif
!if $(TCL_COMPILE_DEBUG)
OPTDEFINES	= $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
!endif
!if $(TCL_THREADS)
OPTDEFINES	= $(OPTDEFINES) -DTCL_THREADS=1
!if $(USE_THREAD_ALLOC)
OPTDEFINES	= $(OPTDEFINES) -DUSE_THREAD_ALLOC=1
!endif
!if $(USE_THREAD_STORAGE)
OPTDEFINES	= $(OPTDEFINES) -DUSE_THREAD_STORAGE=1
!endif
!endif
!if $(STATIC_BUILD)
OPTDEFINES	= $(OPTDEFINES) -DSTATIC_BUILD
!endif
!if $(TCL_NO_DEPRECATED)
OPTDEFINES	= $(OPTDEFINES) -DTCL_NO_DEPRECATED
!endif

!if $(DEBUG)
OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_DEBUG
!elseif $(OPTIMIZING)
OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_OPTIMIZED

!endif
!if $(PROFILE)
OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_PROFILED
!endif
!if "$(MACHINE)" == "IA64"
OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_DO64BIT
!endif





#----------------------------------------------------------
# Get common info used when building extensions.
#----------------------------------------------------------

!if "$(PROJECT)" != "tcl"





# If INSTALLDIR set to tcl root dir then reset to the lib dir.
!if exist("$(_INSTALLDIR)\include\tcl.h")
_INSTALLDIR=$(_INSTALLDIR)\lib
!endif

!if !defined(TCLDIR)
................................................................................
_TCL_H          = $(_TCLDIR)\generic\tcl.h
!else
MSG =^
Failed to find tcl.h.  The TCLDIR macro does not appear correct.
!error $(MSG)
!endif
!endif







!if [echo REM = This file is generated from rules.vc > version.vc]
!endif
!if exist("$(_TCL_H)")


!if [echo TCL_DOTVERSION = \>> version.vc] \
   && [nmakehlp -V "$(_TCL_H)" TCL_VERSION >> version.vc]
!endif


!endif

!include version.vc







TCL_VERSION	= $(TCL_DOTVERSION:.=)

!if $(TCLINSTALL)
TCLSH		= "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe"
!if !exist($(TCLSH)) && $(TCL_THREADS)
TCLSH           = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe"
!endif
TCLSTUBLIB	= "$(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib"
................................................................................
!endif
TCLSTUBLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib"
TCLIMPLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib"
TCL_LIBRARY	= $(_TCLDIR)\library
TCL_INCLUDES	= -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
!endif

!endif

#----------------------------------------------------------
# Optionally check for Tk info for building extensions.
#----------------------------------------------------------

!ifdef PROJECT_REQUIRES_TK
!if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk"

!if !defined(TKDIR)
!if exist("$(_INSTALLDIR)\..\include\tk.h")
TKINSTALL      = 1
_TKDIR         = $(_INSTALLDIR)\..
_TK_H          = $(_TKDIR)\include\tk.h
TKDIR          = $(_TKDIR)
!elseif exist("$(_TCLDIR)\include\tk.h")
TKINSTALL      = 1
_TKDIR         = $(_TCLDIR)
_TK_H          = $(_TKDIR)\include\tk.h
TKDIR          = $(_TKDIR)
!endif
!else
_TKDIR = $(TKDIR:/=\)
!if exist("$(_TKDIR)\include\tk.h")
TKINSTALL      = 1
_TK_H          = $(_TKDIR)\include\tk.h
!elseif exist("$(_TKDIR)\generic\tk.h")
TKINSTALL      = 0
_TK_H          = $(_TKDIR)\generic\tk.h
!else
MSG =^
Failed to find tk.h. The TKDIR macro does not appear correct.
!error $(MSG)
!endif
!endif

!if defined(TKDIR)
TK_DOTVERSION = 8.4
!if exist("$(_TK_H)")
!if [echo TK_DOTVERSION = \>> version.vc] \
   && [nmakehlp -V "$(_TK_H)" TK_VERSION >> version.vc]
!endif
!endif
!include version.vc
TK_VERSION = $(TK_DOTVERSION:.=)

!if $(TKINSTALL)
WISH		= "$(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX).exe"
TKSTUBLIB	= "$(_TKDIR)\lib\tkstub$(TK_VERSION).lib"
TKIMPLIB	= "$(_TKDIR)\lib\tk$(TK_VERSION)$(SUFX).lib"
TK_INCLUDES     = -I"$(_TKDIR)\include"
!else
WISH		= "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX).exe"
TKSTUBLIB	= "$(_TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib"
TKIMPLIB	= "$(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX).lib"
TK_INCLUDES     = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib"
!endif

!endif
!endif
!endif

#----------------------------------------------------------
# Display stats being used.
#----------------------------------------------------------

!message *** Intermediate directory will be '$(TMP_DIR)'







<
<
<
<
<
<
<
<
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|







 







>
>
>
>
>







 







|

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










>

>
|



<








>
>
>
>




>
>
>


>
>
|








>


>






>
>
>
>
>
>






>
>
>
>
>
>
>
>
>










<
<

|
|
|
<
<








<
<
<
<
<
<
<
<
<







 







|







 







<


<







 







|









|
>
>
>

|

>
>
>

>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





|












<
<
<








|
|
|

>




|


>
>
>



|


|
>
>
>
>







 







>
>
>
>
>
>



|
>
>
|
|

>
>

>
|
>
>
>
>
>
>
>
|







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







29
30
31
32
33
34
35












36
37
38
39
40
41
42
..
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
...
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
...
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
...
210
211
212
213
214
215
216
217
218






















219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235

236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308


309
310
311
312


313
314
315
316
317
318
319
320









321
322
323
324
325
326
327
...
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
...
356
357
358
359
360
361
362

363
364

365
366
367
368
369
370
371
...
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477



478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
...
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
...
585
586
587
588
589
590
591




























































592
593
594
595
596
597
598
### Assume the normal default.
_INSTALLDIR	= C:\Program Files\Tcl
!else
### Fix the path separators.
_INSTALLDIR	= $(INSTALLDIR:/=\)
!endif













#----------------------------------------------------------
# Set the proper copy method to avoid overwrite questions
# to the user when copying files and selecting the right
# "delete all" method.
#----------------------------------------------------------

!if "$(OS)" == "Windows_NT"
................................................................................
CPY	= xcopy /i >_JUNK.OUT # On Win98 NUL does not work here.
COPY	= copy >_JUNK.OUT # On Win98 NUL does not work here.
RMDIR	= deltree /Y
NULL    = \NUL # Used in testing directory existence
ERRNULL = >NUL # Win9x shell cannot redirect stderr
!endif
MKDIR   = mkdir

#------------------------------------------------------------------------------
# Determine the host and target architectures and compiler version.
#------------------------------------------------------------------------------

_HASH=^#
_VC_MANIFEST_EMBED_EXE=
_VC_MANIFEST_EMBED_DLL=
VCVER=0
!if ![echo VCVERSION=_MSC_VER > vercl.x] \
    && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
    && ![echo ARCH=IX86 >> vercl.x] \
    && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
    && ![echo ARCH=AMD64 >> vercl.x] \
    && ![echo $(_HASH)endif >> vercl.x] \
    && ![cl -nologo -TC -P vercl.x $(ERRNULL)]
!include vercl.i
!if ![echo VCVER= ^\> vercl.vc] \
    && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
!include vercl.vc
!endif
!endif
!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
!endif

!if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86]
NATIVE_ARCH=IX86
!else
NATIVE_ARCH=AMD64
!endif

# Since MSVC8 we must deal with manifest resources.
!if $(VCVERSION) >= 1400
_VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1
_VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2
!endif

!ifndef MACHINE
MACHINE=$(ARCH)
!endif

!ifndef CFG_ENCODING
CFG_ENCODING	= \"cp1252\"
!endif

!message ===============================================================================

#----------------------------------------------------------
# build the helper app we need to overcome nmake's limiting
# environment.
#----------------------------------------------------------
................................................................................

!if [nmakehlp -c -RTC1]
DEBUGFLAGS     = $(DEBUGFLAGS) -RTC1
!elseif [nmakehlp -c -GZ]
DEBUGFLAGS     = $(DEBUGFLAGS) -GZ
!endif

COMPILERFLAGS  =-W3 /D_ATL_XP_TARGETING

# In v13 -GL and -YX are incompatible.
!if [nmakehlp -c -YX]
!if ![nmakehlp -c -GL]
OPTIMIZATIONS  = $(OPTIMIZATIONS) -YX
!endif
!endif
................................................................................
!if [nmakehlp -c -QIA64_Bx]
!message *** Compiler has 'B-stepping errata workarounds'
COMPILERFLAGS   = $(COMPILERFLAGS) -QIA64_Bx
!else
!message *** Compiler does not have 'B-stepping errata workarounds'
!endif
!endif

# Prevents "LNK1561: entry point must be defined" error compiling from VS-IDE:
!ifndef LINKER_TESTFLAGS
LINKER_TESTFLAGS = /DLL /NOENTRY /OUT:nmhlp-out.txt
!endif

!if "$(MACHINE)" == "IX86"
### test for -align:4096, when align:512 will do.
!if [nmakehlp -l -opt:nowin98]
!message *** Linker has 'Win98 alignment problem'
ALIGN98_HACK	= 1
!else
................................................................................
!endif
!else
ALIGN98_HACK	= 0
!endif

LINKERFLAGS     =

!if [nmakehlp -l -ltcg $(LINKER_TESTFLAGS)]
LINKERFLAGS     =-ltcg






















!endif

#----------------------------------------------------------
# Decode the options requested.
#----------------------------------------------------------

!if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"]
STATIC_BUILD	= 0
TCL_THREADS	= 1
DEBUG		= 0
SYMBOLS		= 0
PROFILE		= 0
PGO		= 0
MSVCRT		= 1
LOIMPACT	= 0
TCL_USE_STATIC_PACKAGES	= 0
USE_THREAD_ALLOC = 1

UNCHECKED       = 0
!else
!if [nmakehlp -f $(OPTS) "static"]
!message *** Doing static
STATIC_BUILD	= 1
!else
STATIC_BUILD	= 0
!endif
!if [nmakehlp -f $(OPTS) "nomsvcrt"]
!message *** Doing nomsvcrt
MSVCRT		= 0
!else
!if [nmakehlp -f $(OPTS) "msvcrt"]
!message *** Doing msvcrt
MSVCRT		= 1
!else
!if !$(STATIC_BUILD)
MSVCRT		= 1
!else
MSVCRT		= 0
!endif
!endif
!endif
!if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD)
!message *** Doing staticpkg
TCL_USE_STATIC_PACKAGES	= 1
!else
TCL_USE_STATIC_PACKAGES	= 0
!endif
!if [nmakehlp -f $(OPTS) "nothreads"]
!message *** Compile explicitly for non-threaded tcl
TCL_THREADS	= 0
USE_THREAD_ALLOC= 0
!else
TCL_THREADS     = 1
USE_THREAD_ALLOC= 1
!endif
!if [nmakehlp -f $(OPTS) "symbols"]
!message *** Doing symbols
DEBUG		= 1
!else
DEBUG		= 0
!endif
!if [nmakehlp -f $(OPTS) "pdbs"]
!message *** Doing pdbs
SYMBOLS		= 1
!else
SYMBOLS		= 0
!endif
!if [nmakehlp -f $(OPTS) "profile"]
!message *** Doing profile
PROFILE		= 1
!else
PROFILE		= 0
!endif
!if [nmakehlp -f $(OPTS) "pgi"]
!message *** Doing profile guided optimization instrumentation
PGO		= 1
!elseif [nmakehlp -f $(OPTS) "pgo"]
!message *** Doing profile guided optimization
PGO		= 2
!else
PGO		= 0
!endif
!if [nmakehlp -f $(OPTS) "loimpact"]
!message *** Doing loimpact
LOIMPACT	= 1
!else
LOIMPACT	= 0
!endif
!if [nmakehlp -f $(OPTS) "thrdalloc"]
!message *** Doing thrdalloc
USE_THREAD_ALLOC = 1


!endif
!if [nmakehlp -f $(OPTS) "tclalloc"]
!message *** Doing tclalloc
USE_THREAD_ALLOC = 0


!endif
!if [nmakehlp -f $(OPTS) "unchecked"]
!message *** Doing unchecked
UNCHECKED = 1
!else
UNCHECKED = 0
!endif
!endif










#----------------------------------------------------------
# Figure-out how to name our intermediate and output directories.
# We wouldn't want different builds to use the same .obj files
# by accident.
#----------------------------------------------------------

................................................................................
#   s = static library (as opposed to an
#	import library)
#   g = linked to the debug enabled C
#	run-time.
#   x = special static build when it
#	links to the dynamic C run-time.
#----------------------------------------
SUFX	    = tsgx

!if $(DEBUG)
BUILDDIRTOP = Debug
!else
BUILDDIRTOP = Release
!endif

................................................................................

TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX

!if !$(STATIC_BUILD)
TMP_DIRFULL = $(TMP_DIRFULL:Static=)
SUFX	    = $(SUFX:s=)
EXT	    = dll

TMP_DIRFULL = $(TMP_DIRFULL:X=)
SUFX	    = $(SUFX:x=)

!else
TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=)
EXT	    = lib
!if !$(MSVCRT)
TMP_DIRFULL = $(TMP_DIRFULL:X=)
SUFX	    = $(SUFX:x=)
!endif
................................................................................

#----------------------------------------------------------
# Decode the checks requested.
#----------------------------------------------------------

!if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"]
TCL_NO_DEPRECATED	    = 0
WARNINGS		    = -W3
!else
!if [nmakehlp -f $(CHECKS) "nodep"]
!message *** Doing nodep check
TCL_NO_DEPRECATED	    = 1
!else
TCL_NO_DEPRECATED	    = 0
!endif
!if [nmakehlp -f $(CHECKS) "fullwarn"]
!message *** Doing full warnings check
WARNINGS		    = -W4
!if [nmakehlp -l -warn:3 $(LINKER_TESTFLAGS)]
LINKERFLAGS		    = $(LINKERFLAGS) -warn:3
!endif
!else
WARNINGS		    = -W3
!endif
!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64]
!message *** Doing 64bit portability warnings
WARNINGS		    = $(WARNINGS) -Wp64
!endif
!endif

!if $(PGO) > 1
!if [nmakehlp -l -ltcg:pgoptimize $(LINKER_TESTFLAGS)]
LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize
!else
MSG=^
This compiler does not support profile guided optimization.
!error $(MSG)
!endif
!elseif $(PGO) > 0
!if [nmakehlp -l -ltcg:pginstrument $(LINKER_TESTFLAGS)]
LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument
!else
MSG=^
This compiler does not support profile guided optimization.
!error $(MSG)
!endif
!endif

#----------------------------------------------------------
# Set our defines now armed with our options.
#----------------------------------------------------------

OPTDEFINES	= -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS

!if $(TCL_MEM_DEBUG)
OPTDEFINES	= $(OPTDEFINES) -DTCL_MEM_DEBUG
!endif
!if $(TCL_COMPILE_DEBUG)
OPTDEFINES	= $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
!endif
!if $(TCL_THREADS)
OPTDEFINES	= $(OPTDEFINES) -DTCL_THREADS=1
!if $(USE_THREAD_ALLOC)
OPTDEFINES	= $(OPTDEFINES) -DUSE_THREAD_ALLOC=1
!endif



!endif
!if $(STATIC_BUILD)
OPTDEFINES	= $(OPTDEFINES) -DSTATIC_BUILD
!endif
!if $(TCL_NO_DEPRECATED)
OPTDEFINES	= $(OPTDEFINES) -DTCL_NO_DEPRECATED
!endif

!if !$(DEBUG)
OPTDEFINES	= $(OPTDEFINES) -DNDEBUG
!if $(OPTIMIZING)
OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_OPTIMIZED
!endif
!endif
!if $(PROFILE)
OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_PROFILED
!endif
!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_DO64BIT
!endif
!if $(VCVERSION) < 1300
OPTDEFINES	= $(OPTDEFINES) -DNO_STRTOI64
!endif


#----------------------------------------------------------
# Locate the Tcl headers to build against
#----------------------------------------------------------

!if "$(PROJECT)" == "tcl"

_TCL_H          = ..\generic\tcl.h

!else

# If INSTALLDIR set to tcl root dir then reset to the lib dir.
!if exist("$(_INSTALLDIR)\include\tcl.h")
_INSTALLDIR=$(_INSTALLDIR)\lib
!endif

!if !defined(TCLDIR)
................................................................................
_TCL_H          = $(_TCLDIR)\generic\tcl.h
!else
MSG =^
Failed to find tcl.h.  The TCLDIR macro does not appear correct.
!error $(MSG)
!endif
!endif
!endif

#--------------------------------------------------------------
# Extract various version numbers from tcl headers
# The generated file is then included in the makefile.
#--------------------------------------------------------------

!if [echo REM = This file is generated from rules.vc > version.vc]
!endif
!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \
   && [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc]
!endif
!if [echo TCL_MINOR_VERSION = \>> versions.vc] \
   && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc]
!endif
!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \
   && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc]
!endif

!include versions.vc

#--------------------------------------------------------------
# Setup tcl version dependent stuff headers
#--------------------------------------------------------------

!if "$(PROJECT)" != "tcl"

TCL_VERSION	= $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION)

!if $(TCLINSTALL)
TCLSH		= "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe"
!if !exist($(TCLSH)) && $(TCL_THREADS)
TCLSH           = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe"
!endif
TCLSTUBLIB	= "$(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib"
................................................................................
!endif
TCLSTUBLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib"
TCLIMPLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib"
TCL_LIBRARY	= $(_TCLDIR)\library
TCL_INCLUDES	= -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
!endif





























































!endif

#----------------------------------------------------------
# Display stats being used.
#----------------------------------------------------------

!message *** Intermediate directory will be '$(TMP_DIR)'