Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch deCONST Excluding Merge-Ins

This is equivalent to a diff from a54f9b058d to 9eb5979f33

2018-04-07
00:59
Still builds (and works) back to 8.4 (and maybe even to 8.3) and now new also with (current) 9.0. Test suite needs some more updates to work w/ 9.0 without errors. check-in: c20f5260c7 user: rolf tags: trunk
00:51
Builds now with 8.4 (and maybe even with 8.3) until (current) 9.0. Test suite needs some more updates to work w/ 9.0 without errors. Closed-Leaf check-in: 9eb5979f33 user: rolf tags: deCONST
2018-04-06
16:18
Merged from trunk. check-in: 920496e776 user: rolf tags: deCONST
16:18
Pruned out more old ANSI_ARGS usage. check-in: a54f9b058d user: rolf tags: trunk
09:44
Test to document problem fixed with [0fb34974584ae2]. check-in: d573bb0b47 user: rolf tags: trunk

Changes to doc/expatapi.html.

154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
parser object in the interpreter <i class="m">interp</i>, otherwise it returns
0. Example:</p><pre class="example">
int
TclExampleObjCmd(dummy, interp, objc, objv)
     ClientData dummy;
     Tcl_Interp *interp;
     int objc;
     Tcl_Obj *CONST objv[];
{
    char          *method;
    CHandlerSet   *handlerSet;
    int            methodIndex, result;
    simpleCounter *counter;
    








|







154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
parser object in the interpreter <i class="m">interp</i>, otherwise it returns
0. Example:</p><pre class="example">
int
TclExampleObjCmd(dummy, interp, objc, objv)
     ClientData dummy;
     Tcl_Interp *interp;
     int objc;
     Tcl_Obj *const objv[];
{
    char          *method;
    CHandlerSet   *handlerSet;
    int            methodIndex, result;
    simpleCounter *counter;
    

Changes to doc/expatapi.n.

324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
.CS

int
TclExampleObjCmd(dummy, interp, objc, objv)
     ClientData dummy;
     Tcl_Interp *interp;
     int objc;
     Tcl_Obj *CONST objv[];
{
    char          *method;
    CHandlerSet   *handlerSet;
    int            methodIndex, result;
    simpleCounter *counter;
    








|







324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
.CS

int
TclExampleObjCmd(dummy, interp, objc, objv)
     ClientData dummy;
     Tcl_Interp *interp;
     int objc;
     Tcl_Obj *const objv[];
{
    char          *method;
    CHandlerSet   *handlerSet;
    int            methodIndex, result;
    simpleCounter *counter;
    

Changes to doc/expatapi.xml.

191
192
193
194
195
196
197
198
199
200
201
202
203
204
205

<example>
int
TclExampleObjCmd(dummy, interp, objc, objv)
     ClientData dummy;
     Tcl_Interp *interp;
     int objc;
     Tcl_Obj *CONST objv[];
{
    char          *method;
    CHandlerSet   *handlerSet;
    int            methodIndex, result;
    simpleCounter *counter;
    








|







191
192
193
194
195
196
197
198
199
200
201
202
203
204
205

<example>
int
TclExampleObjCmd(dummy, interp, objc, objv)
     ClientData dummy;
     Tcl_Interp *interp;
     int objc;
     Tcl_Obj *const objv[];
{
    char          *method;
    CHandlerSet   *handlerSet;
    int            methodIndex, result;
    simpleCounter *counter;
    

Changes to generic/dom.c.

1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
/*---------------------------------------------------------------------------
|  externalEntityRefHandler
|
\--------------------------------------------------------------------------*/
static int
externalEntityRefHandler (
    XML_Parser  parser,
    CONST char *openEntityNames,
    CONST char *base,
    CONST char *systemId,
    CONST char *publicId
)
{
    domReadInfo   *info = (domReadInfo *) XML_GetUserData (parser);

    Tcl_Obj *cmdPtr, *resultObj, *resultTypeObj, *extbaseObj, *xmlstringObj;
    Tcl_Obj *channelIdObj;
    int result, mode, done, byteIndex, i;
    int keepresult = 0;
    size_t len;
    int tclLen;
    XML_Parser extparser, oldparser = NULL;
    char buf[4096], *resultType, *extbase, *xmlstring, *channelId, s[50];
    Tcl_Channel chan = (Tcl_Channel) NULL;
    enum XML_Status status;
    XML_Index storedNextFeedbackPosition;
    CONST84 char *interpResult;

    if (info->document->extResolver == NULL) {
        Tcl_AppendResult (info->interp, "Can't read external entity \"",
                          systemId, "\": No -externalentitycommand given",
                          NULL);
        return 0;
    }







|
|
|
|















|







1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
/*---------------------------------------------------------------------------
|  externalEntityRefHandler
|
\--------------------------------------------------------------------------*/
static int
externalEntityRefHandler (
    XML_Parser  parser,
    const char *openEntityNames,
    const char *base,
    const char *systemId,
    const char *publicId
)
{
    domReadInfo   *info = (domReadInfo *) XML_GetUserData (parser);

    Tcl_Obj *cmdPtr, *resultObj, *resultTypeObj, *extbaseObj, *xmlstringObj;
    Tcl_Obj *channelIdObj;
    int result, mode, done, byteIndex, i;
    int keepresult = 0;
    size_t len;
    int tclLen;
    XML_Parser extparser, oldparser = NULL;
    char buf[4096], *resultType, *extbase, *xmlstring, *channelId, s[50];
    Tcl_Channel chan = (Tcl_Channel) NULL;
    enum XML_Status status;
    XML_Index storedNextFeedbackPosition;
    const char *interpResult;

    if (info->document->extResolver == NULL) {
        Tcl_AppendResult (info->interp, "Can't read external entity \"",
                          systemId, "\": No -externalentitycommand given",
                          NULL);
        return 0;
    }
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
}

int
TclTdomObjCmd (dummy, interp, objc, objv)
     ClientData dummy;
     Tcl_Interp *interp;
     int objc;
     Tcl_Obj *CONST objv[];
{
    char            *encodingName;
    CHandlerSet     *handlerSet;
    int              methodIndex, result, bool;
    tdomCmdReadInfo *info;
    TclGenExpatInfo *expat;
    Tcl_Obj         *newObjName = NULL;
    TEncoding       *encoding;

    static CONST84 char *tdomMethods[] = {
        "enable", "getdoc",
        "setResultEncoding", "setStoreLineColumn",
        "setExternalEntityResolver", "keepEmpties",
        "remove", "ignorexmlns", "keepCDATA",
        NULL
    };
    enum tdomMethod {







|









|







5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
}

int
TclTdomObjCmd (dummy, interp, objc, objv)
     ClientData dummy;
     Tcl_Interp *interp;
     int objc;
     Tcl_Obj *const objv[];
{
    char            *encodingName;
    CHandlerSet     *handlerSet;
    int              methodIndex, result, bool;
    tdomCmdReadInfo *info;
    TclGenExpatInfo *expat;
    Tcl_Obj         *newObjName = NULL;
    TEncoding       *encoding;

    static const char *tdomMethods[] = {
        "enable", "getdoc",
        "setResultEncoding", "setStoreLineColumn",
        "setExternalEntityResolver", "keepEmpties",
        "remove", "ignorexmlns", "keepCDATA",
        NULL
    };
    enum tdomMethod {

Changes to generic/dom.h.

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
       my_malloc, my_realloc, my_free
   };
#  define MEM_SUITE &memsuite
#else
#  define MEM_SUITE NULL
#endif

/*
 * Beginning with 8.4, Tcl API is CONST'ified
 */
#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION <= 3)
# define CONST84
#endif

/*
 * Beginning with 8.6, interp->errorLine isn't public visible anymore
 * (TIP 330)
 */
#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6)
# define Tcl_GetErrorLine(interp) (interp)->errorLine
#endif







<
<
<
<
<
<
<







82
83
84
85
86
87
88







89
90
91
92
93
94
95
       my_malloc, my_realloc, my_free
   };
#  define MEM_SUITE &memsuite
#else
#  define MEM_SUITE NULL
#endif








/*
 * Beginning with 8.6, interp->errorLine isn't public visible anymore
 * (TIP 330)
 */
#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6)
# define Tcl_GetErrorLine(interp) (interp)->errorLine
#endif

Changes to generic/domxslt.c.

5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
{
    Tcl_Obj      *cmdPtr, *resultObj, *extbaseObj, *xmlstringObj;
    Tcl_Obj      *channelIdObj, *resultTypeObj;
    int           len, mode, result, storeLineColumn;
    int           resultcode = 0;
    char         *resultType, *extbase, *xmlstring, *channelId, s[20];
    Tcl_Obj      *extResolver = NULL;
    CONST84 char *str;
    domDocument  *doc;
    xsltSubDoc   *sdoc;
    XML_Parser    parser;
    Tcl_Channel   chan;
    Tcl_DString   dStr;
    
    if (isStylesheet && (href[0] == '\0')) {







|







5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
{
    Tcl_Obj      *cmdPtr, *resultObj, *extbaseObj, *xmlstringObj;
    Tcl_Obj      *channelIdObj, *resultTypeObj;
    int           len, mode, result, storeLineColumn;
    int           resultcode = 0;
    char         *resultType, *extbase, *xmlstring, *channelId, s[20];
    Tcl_Obj      *extResolver = NULL;
    const char   *str;
    domDocument  *doc;
    xsltSubDoc   *sdoc;
    XML_Parser    parser;
    Tcl_Channel   chan;
    Tcl_DString   dStr;
    
    if (isStylesheet && (href[0] == '\0')) {

Changes to generic/nodecmd.c.

103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*----------------------------------------------------------------------------
|   Forward declarations
|
\---------------------------------------------------------------------------*/
static void * StackPush  (void *);
static void * StackPop   (void);
static void * StackTop   (void);
static int    NodeObjCmd (ClientData,Tcl_Interp*,int,Tcl_Obj *CONST o[]);
static void   StackFinalize (ClientData);

extern int tcldom_appendXML (Tcl_Interp*, domNode*, Tcl_Obj*);


/*----------------------------------------------------------------------------
|   StackPush







|







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*----------------------------------------------------------------------------
|   Forward declarations
|
\---------------------------------------------------------------------------*/
static void * StackPush  (void *);
static void * StackPop   (void);
static void * StackTop   (void);
static int    NodeObjCmd (ClientData,Tcl_Interp*,int,Tcl_Obj *const o[]);
static void   StackFinalize (ClientData);

extern int tcldom_appendXML (Tcl_Interp*, domNode*, Tcl_Obj*);


/*----------------------------------------------------------------------------
|   StackPush
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
\---------------------------------------------------------------------------*/
static int
NodeObjCmd (
    ClientData      arg,                /* Type of node to create. */
    Tcl_Interp    * interp,             /* Current interpreter. */
    int             objc,               /* Number of arguments. */
    Tcl_Obj *CONST  objv[]             /* Argument objects. */
) {
    int type, createType, len, dlen, i, ret, disableOutputEscaping = 0, 
        index = 1;
    char *tag, *p, *tval, *aval;
    domNode *parent, *newNode = NULL;
    domTextNode *textNode = NULL;
    domDocument *doc;







|







278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
\---------------------------------------------------------------------------*/
static int
NodeObjCmd (
    ClientData      arg,                /* Type of node to create. */
    Tcl_Interp    * interp,             /* Current interpreter. */
    int             objc,               /* Number of arguments. */
    Tcl_Obj *const  objv[]             /* Argument objects. */
) {
    int type, createType, len, dlen, i, ret, disableOutputEscaping = 0, 
        index = 1;
    char *tag, *p, *tval, *aval;
    domNode *parent, *newNode = NULL;
    domTextNode *textNode = NULL;
    domDocument *doc;
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
|      % puts [$n asHTML]
|
\---------------------------------------------------------------------------*/
int
nodecmd_createNodeCmd (
    Tcl_Interp    * interp,             /* Current interpreter. */
    int             objc,               /* Number of arguments. */
    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
     */

    enum subCmd {
        ELM_NODE, TXT_NODE, CDS_NODE, CMT_NODE, PIC_NODE, PRS_NODE
    };

    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
    };








|




















|




|







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
|      % puts [$n asHTML]
|
\---------------------------------------------------------------------------*/
int
nodecmd_createNodeCmd (
    Tcl_Interp    * interp,             /* Current interpreter. */
    int             objc,               /* Number of arguments. */
    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
     */

    enum subCmd {
        ELM_NODE, TXT_NODE, CDS_NODE, CMT_NODE, PIC_NODE, PRS_NODE
    };

    static const char *subcmds[] = {
        "elementNode", "textNode", "cdataNode", "commentNode", "piNode",
        "parserNode", NULL
    };

    static const char *options[] = {
        "-returnNodeCmd", "-jsonType", "-tagName", "-namespace", NULL
    };

    enum option {
        o_returnNodeCmd, o_jsonType, o_tagName, o_namespace
    };

Changes to generic/nodecmd.h.

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|   Written by Zoran Vasiljevic
|   July 12, 2000
|
\---------------------------------------------------------------------------*/

int nodecmd_createNodeCmd (Tcl_Interp    * interp,
                           int             objc,
                           Tcl_Obj *CONST  objv[],
                           int             checkName,
                           int             checkCharData);

int nodecmd_appendFromScript (Tcl_Interp *interp, 
                              domNode    *node,
                              Tcl_Obj    *cmdObj);








|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|   Written by Zoran Vasiljevic
|   July 12, 2000
|
\---------------------------------------------------------------------------*/

int nodecmd_createNodeCmd (Tcl_Interp    * interp,
                           int             objc,
                           Tcl_Obj *const  objv[],
                           int             checkName,
                           int             checkCharData);

int nodecmd_appendFromScript (Tcl_Interp *interp, 
                              domNode    *node,
                              Tcl_Obj    *cmdObj);

Changes to generic/tcldom.c.

356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
    "    jsonType ?jsonType?          \n"
    TDomThreaded(
    "    readlock                     \n"
    "    writelock                    \n"
    )
;

static CONST84 char *jsonTypes[] = {
    "NONE",
    "ARRAY",
    "OBJECT",
    "NULL",
    "TRUE",
    "FALSE",
    "STRING",







|







356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
    "    jsonType ?jsonType?          \n"
    TDomThreaded(
    "    readlock                     \n"
    "    writelock                    \n"
    )
;

static const char *jsonTypes[] = {
    "NONE",
    "ARRAY",
    "OBJECT",
    "NULL",
    "TRUE",
    "FALSE",
    "STRING",
394
395
396
397
398
399
400






401






402
403
404

405
406
407
408
409
410
411
    SetTdomNodeFromAny
};

/*----------------------------------------------------------------------------
|   Prototypes for procedures defined later in this file:
|
\---------------------------------------------------------------------------*/













static Tcl_VarTraceProc  tcldom_docTrace;

static Tcl_CmdDeleteProc tcldom_docCmdDeleteProc;


static void tcldom_treeAsJSON(Tcl_Obj *jstring, domNode *node,
                              Tcl_Channel channel, int indent,
                              int level,
                              int inside);

#ifdef TCL_THREADS







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

<

>







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
    SetTdomNodeFromAny
};

/*----------------------------------------------------------------------------
|   Prototypes for procedures defined later in this file:
|
\---------------------------------------------------------------------------*/
#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION <= 3)
/*
 * Before Tcl 8.4, Tcl_VarTraceProc and Tcl_CmdDeleteProc were not
 * CONST84'ified. When compiling with -DTCL_NO_DEPRECATED, CONST84 is
 * gone, therefore we can't use the function type definitions of
 * Tcl_VarTraceProc and Tcl_CmdDeleteProc for these old version.
 * 
 */
static char * tcldom_docTrace(
    ClientData clientData, Tcl_Interp *interp,
    const char *part1, const char *part2, int flags);
static void tcldom_docCmdDeleteProc(ClientData clientData);
#else 
static Tcl_VarTraceProc  tcldom_docTrace;

static Tcl_CmdDeleteProc tcldom_docCmdDeleteProc;
#endif

static void tcldom_treeAsJSON(Tcl_Obj *jstring, domNode *node,
                              Tcl_Channel channel, int indent,
                              int level,
                              int inside);

#ifdef TCL_THREADS
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
|   tcldom_docTrace
|
\---------------------------------------------------------------------------*/
static
char * tcldom_docTrace (
    ClientData    clientData,
    Tcl_Interp   *interp,
    CONST84 char *name1,
    CONST84 char *name2,
    int           flags
)
{
    domDeleteInfo *dinfo = (domDeleteInfo*) clientData;
    domDocument   *doc   = dinfo->document;
    char           objCmdName[80];








|
|







537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
|   tcldom_docTrace
|
\---------------------------------------------------------------------------*/
static
char * tcldom_docTrace (
    ClientData    clientData,
    Tcl_Interp   *interp,
    const char *name1,
    const char *name2,
    int           flags
)
{
    domDeleteInfo *dinfo = (domDeleteInfo*) clientData;
    domDocument   *doc   = dinfo->document;
    char           objCmdName[80];

952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
\---------------------------------------------------------------------------*/
static
int tcldom_xpointerSearch (
    Tcl_Interp * interp,
    int          mode,
    domNode    * node,
    int          objc,
    Tcl_Obj    * CONST  objv[]
)
{
    char *str;
    int   i = 0;
    int   result = 0;
    int   all = 0;
    int   instance = 0;







|







964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
\---------------------------------------------------------------------------*/
static
int tcldom_xpointerSearch (
    Tcl_Interp * interp,
    int          mode,
    domNode    * node,
    int          objc,
    Tcl_Obj    * const  objv[]
)
{
    char *str;
    int   i = 0;
    int   result = 0;
    int   all = 0;
    int   instance = 0;
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
char * tcldom_xpathResolveVar (
    void  *clientData,
    char  *strToParse,
    int   *offset,
    char **errMsg
    )
{
    CONST char *varValue;
    CONST char *termPtr;
    Tcl_Interp *interp = (Tcl_Interp *) clientData;
    
    *offset = 0;
    varValue = Tcl_ParseVar(interp, strToParse, &termPtr);
    if (varValue) {
        *offset = termPtr - strToParse;
        /* If strToParse start with a single '$' without a following







|
|







1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
char * tcldom_xpathResolveVar (
    void  *clientData,
    char  *strToParse,
    int   *offset,
    char **errMsg
    )
{
    const char *varValue;
    const char *termPtr;
    Tcl_Interp *interp = (Tcl_Interp *) clientData;
    
    *offset = 0;
    varValue = Tcl_ParseVar(interp, strToParse, &termPtr);
    if (varValue) {
        *offset = termPtr - strToParse;
        /* If strToParse start with a single '$' without a following
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
|
\---------------------------------------------------------------------------*/
static
int tcldom_selectNodes (
    Tcl_Interp *interp,
    domNode    *node,
    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 {
        o_namespaces, o_cache
    };

    if (objc < 2) {







|











|







1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
|
\---------------------------------------------------------------------------*/
static
int tcldom_selectNodes (
    Tcl_Interp *interp,
    domNode    *node,
    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 const char *selectNodesOptions[] = {
        "-namespaces", "-cache", NULL
    };
    enum selectNodesOption {
        o_namespaces, o_cache
    };

    if (objc < 2) {
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
|   serializeAsXML
|
\---------------------------------------------------------------------------*/
static int serializeAsXML (
    domNode    *node,
    Tcl_Interp *interp,
    int         objc,
    Tcl_Obj    *CONST objv[]
)
{
    char          *channelId, prefix[MAX_PREFIX_LEN];
    const char    *localName;
    int            indent, mode, escapeNonASCII = 0, doctypeDeclaration = 0;
    int            xmlDeclaration = 0;
    int            optionIndex, cdataChild, escapeAllQuot = 0;
    Tcl_Obj       *resultPtr, *encString = NULL;
    Tcl_Channel    chan = (Tcl_Channel) NULL;
    Tcl_HashEntry *h;
    Tcl_DString    dStr;
    int            indentAttrs = -1;

    static CONST84 char *asXMLOptions[] = {
        "-indent", "-channel", "-escapeNonASCII", "-doctypeDeclaration",
        "-xmlDeclaration", "-encString", "-escapeAllQuot", "-indentAttrs",
        NULL
    };
    enum asXMLOption {
        m_indent, m_channel, m_escapeNonASCII, m_doctypeDeclaration,
        m_xmlDeclaration, m_encString, m_escapeAllQuot, m_indentAttrs







|













|







3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
|   serializeAsXML
|
\---------------------------------------------------------------------------*/
static int serializeAsXML (
    domNode    *node,
    Tcl_Interp *interp,
    int         objc,
    Tcl_Obj    *const objv[]
)
{
    char          *channelId, prefix[MAX_PREFIX_LEN];
    const char    *localName;
    int            indent, mode, escapeNonASCII = 0, doctypeDeclaration = 0;
    int            xmlDeclaration = 0;
    int            optionIndex, cdataChild, escapeAllQuot = 0;
    Tcl_Obj       *resultPtr, *encString = NULL;
    Tcl_Channel    chan = (Tcl_Channel) NULL;
    Tcl_HashEntry *h;
    Tcl_DString    dStr;
    int            indentAttrs = -1;

    static const char *asXMLOptions[] = {
        "-indent", "-channel", "-escapeNonASCII", "-doctypeDeclaration",
        "-xmlDeclaration", "-encString", "-escapeAllQuot", "-indentAttrs",
        NULL
    };
    enum asXMLOption {
        m_indent, m_channel, m_escapeNonASCII, m_doctypeDeclaration,
        m_xmlDeclaration, m_encString, m_escapeAllQuot, m_indentAttrs
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
|   serializeAsHTML
|
\---------------------------------------------------------------------------*/
static int serializeAsHTML (
    domNode    *node,
    Tcl_Interp *interp,
    int         objc,
    Tcl_Obj    *CONST objv[]
)
{
    char       *channelId;
    int         optionIndex, mode, escapeNonASCII = 0, htmlEntities = 0;
    int         doctypeDeclaration = 0;
    Tcl_Obj    *resultPtr;
    Tcl_Channel chan = (Tcl_Channel) NULL;

    static CONST84 char *asHTMLOptions[] = {
        "-channel", "-escapeNonASCII", "-htmlEntities", "-doctypeDeclaration",
        NULL
    };
    enum asHTMLOption {
        m_channel, m_escapeNonASCII, m_htmlEntities, m_doctypeDeclaration
    };
    







|








|







3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
|   serializeAsHTML
|
\---------------------------------------------------------------------------*/
static int serializeAsHTML (
    domNode    *node,
    Tcl_Interp *interp,
    int         objc,
    Tcl_Obj    *const objv[]
)
{
    char       *channelId;
    int         optionIndex, mode, escapeNonASCII = 0, htmlEntities = 0;
    int         doctypeDeclaration = 0;
    Tcl_Obj    *resultPtr;
    Tcl_Channel chan = (Tcl_Channel) NULL;

    static const char *asHTMLOptions[] = {
        "-channel", "-escapeNonASCII", "-htmlEntities", "-doctypeDeclaration",
        NULL
    };
    enum asHTMLOption {
        m_channel, m_escapeNonASCII, m_htmlEntities, m_doctypeDeclaration
    };
    
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
|   serializeAsJSON
|
\---------------------------------------------------------------------------*/
static int serializeAsJSON (
    domNode    *node,
    Tcl_Interp *interp,
    int         objc,
    Tcl_Obj    *CONST objv[]
)
{
    char       *channelId;
    int         optionIndex, mode, indent = -1;
    Tcl_Obj    *resultPtr;
    Tcl_Channel chan = (Tcl_Channel) NULL;

    static CONST84 char *asJSONOptions[] = {
        "-channel", "-indent",
        NULL
    };
    enum asJSONOption {
        m_channel, m_indent
    };








|







|







3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
|   serializeAsJSON
|
\---------------------------------------------------------------------------*/
static int serializeAsJSON (
    domNode    *node,
    Tcl_Interp *interp,
    int         objc,
    Tcl_Obj    *const objv[]
)
{
    char       *channelId;
    int         optionIndex, mode, indent = -1;
    Tcl_Obj    *resultPtr;
    Tcl_Channel chan = (Tcl_Channel) NULL;

    static const char *asJSONOptions[] = {
        "-channel", "-indent",
        NULL
    };
    enum asJSONOption {
        m_channel, m_indent
    };

3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
|   cdataSectionElements
|
\---------------------------------------------------------------------------*/
static int cdataSectionElements (
    domDocument *doc,
    Tcl_Interp  *interp,
    int          objc,
    Tcl_Obj     *CONST objv[] 
    )
{
    int result, hnew;
    Tcl_Obj *resultPtr,*namePtr;
    Tcl_HashEntry *h;
    Tcl_HashSearch search;
    







|







3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
|   cdataSectionElements
|
\---------------------------------------------------------------------------*/
static int cdataSectionElements (
    domDocument *doc,
    Tcl_Interp  *interp,
    int          objc,
    Tcl_Obj     *const objv[] 
    )
{
    int result, hnew;
    Tcl_Obj *resultPtr,*namePtr;
    Tcl_HashEntry *h;
    Tcl_HashSearch search;
    
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
|   selectNodesNamespaces
|
\---------------------------------------------------------------------------*/
static int selectNodesNamespaces (
    domDocument *doc,
    Tcl_Interp  *interp,
    int          objc,
    Tcl_Obj     *CONST objv[] 
    )
{
    int      len, i, result;
    Tcl_Obj *objPtr, *listPtr;

    CheckArgs (2,3,2, "?prefixUriList?");
    if (objc == 3) {







|







3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
|   selectNodesNamespaces
|
\---------------------------------------------------------------------------*/
static int selectNodesNamespaces (
    domDocument *doc,
    Tcl_Interp  *interp,
    int          objc,
    Tcl_Obj     *const objv[] 
    )
{
    int      len, i, result;
    Tcl_Obj *objPtr, *listPtr;

    CheckArgs (2,3,2, "?prefixUriList?");
    if (objc == 3) {
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
|   renameNodes
|
\---------------------------------------------------------------------------*/
static int renameNodes (
    domDocument *doc,
    Tcl_Interp  *interp,
    int          objc,
    Tcl_Obj     *CONST objv[] 
    )
{
    int      len, i, hnew;
    Tcl_HashEntry *h;
    Tcl_Obj *objPtr;
    domNode     *node;
    







|







3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
|   renameNodes
|
\---------------------------------------------------------------------------*/
static int renameNodes (
    domDocument *doc,
    Tcl_Interp  *interp,
    int          objc,
    Tcl_Obj     *const objv[] 
    )
{
    int      len, i, hnew;
    Tcl_HashEntry *h;
    Tcl_Obj *objPtr;
    domNode     *node;
    
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
|   deleteXPathCache
|
\---------------------------------------------------------------------------*/
static int deleteXPathCache (
    domDocument *doc,
    Tcl_Interp  *interp,
    int          objc,
    Tcl_Obj     *CONST objv[] 
    )
{
    Tcl_HashEntry *h;
    Tcl_HashSearch search;
    
    CheckArgs (2,3,0, "<domDoc> deleteXPathCache ?xpathQuery?");
    if (objc == 3) {







|







4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
|   deleteXPathCache
|
\---------------------------------------------------------------------------*/
static int deleteXPathCache (
    domDocument *doc,
    Tcl_Interp  *interp,
    int          objc,
    Tcl_Obj     *const objv[] 
    )
{
    Tcl_HashEntry *h;
    Tcl_HashSearch search;
    
    CheckArgs (2,3,0, "<domDoc> deleteXPathCache ?xpathQuery?");
    if (objc == 3) {
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
|
\---------------------------------------------------------------------------*/
static int applyXSLT (
    domNode     *node,
    Tcl_Interp  *interp,
    void        *clientData,
    int          objc,
    Tcl_Obj     *CONST objv[]
    )
{
    char          *usage, **parameters = NULL, *errMsg, *option;
    Tcl_Obj       *objPtr, *localListPtr = (Tcl_Obj *)NULL;
    int            i, result, length, optionIndex;
    int            ignoreUndeclaredParameters = 0;
    int            maxApplyDepth = MAX_XSLT_APPLY_DEPTH;
    domDocument   *xsltDoc, *xmlDoc, *resultDoc = NULL;
    XsltMsgCBInfo  xsltMsgInfo;

    static char *method_usage = 
        "wrong # args: should be \"nodeObj xslt ?-parameters parameterList? "
        "?-ignoreUndeclaredParameters? ?-maxApplyDepth int? "
        "?-xsltmessagecmd cmd? xsltDocNode ?varname?\"";

    static char *cmd_usage = 
        "wrong # args: should be \"?-parameters parameterList? "
        "?-ignoreUndeclaredParameters? ?-maxApplyDepth int? "
        "?-xsltmessagecmd cmd? <xmlDocObj> ?objVar?\"";

    static CONST84 char *xsltOptions[] = {
        "-parameters", "-ignoreUndeclaredParameters",
        "-maxApplyDepth", "-xsltmessagecmd", NULL
    };

    enum xsltOption {
        m_parmeters, m_ignoreUndeclaredParameters, m_maxApplyDepth,
        m_xsltmessagecmd







|




















|







4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
|
\---------------------------------------------------------------------------*/
static int applyXSLT (
    domNode     *node,
    Tcl_Interp  *interp,
    void        *clientData,
    int          objc,
    Tcl_Obj     *const objv[]
    )
{
    char          *usage, **parameters = NULL, *errMsg, *option;
    Tcl_Obj       *objPtr, *localListPtr = (Tcl_Obj *)NULL;
    int            i, result, length, optionIndex;
    int            ignoreUndeclaredParameters = 0;
    int            maxApplyDepth = MAX_XSLT_APPLY_DEPTH;
    domDocument   *xsltDoc, *xmlDoc, *resultDoc = NULL;
    XsltMsgCBInfo  xsltMsgInfo;

    static char *method_usage = 
        "wrong # args: should be \"nodeObj xslt ?-parameters parameterList? "
        "?-ignoreUndeclaredParameters? ?-maxApplyDepth int? "
        "?-xsltmessagecmd cmd? xsltDocNode ?varname?\"";

    static char *cmd_usage = 
        "wrong # args: should be \"?-parameters parameterList? "
        "?-ignoreUndeclaredParameters? ?-maxApplyDepth int? "
        "?-xsltmessagecmd cmd? <xmlDocObj> ?objVar?\"";

    static const char *xsltOptions[] = {
        "-parameters", "-ignoreUndeclaredParameters",
        "-maxApplyDepth", "-xsltmessagecmd", NULL
    };

    enum xsltOption {
        m_parmeters, m_ignoreUndeclaredParameters, m_maxApplyDepth,
        m_xsltmessagecmd
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
|   tcldom_XSLTObjCmd
|
\---------------------------------------------------------------------------*/
static int tcldom_XSLTObjCmd (
    ClientData  clientData,
    Tcl_Interp *interp,
    int         objc,
    Tcl_Obj    *CONST objv[]
)
{
    int          index;
    char        *errMsg = NULL;
    
    static CONST84 char *options[] = {
        "transform", "delete", NULL
    };
    enum option {
        m_transform, m_delete
    };
    








|





|







4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
|   tcldom_XSLTObjCmd
|
\---------------------------------------------------------------------------*/
static int tcldom_XSLTObjCmd (
    ClientData  clientData,
    Tcl_Interp *interp,
    int         objc,
    Tcl_Obj    *const objv[]
)
{
    int          index;
    char        *errMsg = NULL;
    
    static const char *options[] = {
        "transform", "delete", NULL
    };
    enum option {
        m_transform, m_delete
    };
    

4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
|   tcldom_NodeObjCmd
|
\---------------------------------------------------------------------------*/
int tcldom_NodeObjCmd (
    ClientData  clientData,
    Tcl_Interp *interp,
    int         objc,
    Tcl_Obj    *CONST objv[]
)
{
    GetTcldomTSD()

    domNode     *node, *child, *refChild, *oldChild, *refNode;
    domNS       *ns;
    domAttrNode *attrs;
    domException exception;
    char         tmp[200], prefix[MAX_PREFIX_LEN], *method, *nodeName,
                 *str, *attr_name, *attr_val, *filter;
    const char  *localName, *uri, *nsStr;
    int          result, length, methodIndex, i, line, column;
    int          nsIndex, bool, hnew, legacy, jsonType;
    Tcl_Obj     *namePtr, *resultPtr;
    Tcl_Obj     *mobjv[MAX_REWRITE_ARGS];
    Tcl_CmdInfo  cmdInfo;
    Tcl_HashEntry *h;

    static CONST84 char *nodeMethods[] = {
        "firstChild",      "nextSibling",    "getAttribute",    "nodeName",
        "nodeValue",       "nodeType",       "attributes",      "asList",
        "find",            "setAttribute",   "removeAttribute", "parentNode",
        "previousSibling", "lastChild",      "appendChild",     "removeChild",
        "hasChildNodes",   "localName",      "childNodes",      "ownerDocument",
        "insertBefore",    "replaceChild",   "getLine",         "getColumn",
        "asXML",           "appendFromList", "child",           "fsibling",







|


















|







4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
|   tcldom_NodeObjCmd
|
\---------------------------------------------------------------------------*/
int tcldom_NodeObjCmd (
    ClientData  clientData,
    Tcl_Interp *interp,
    int         objc,
    Tcl_Obj    *const objv[]
)
{
    GetTcldomTSD()

    domNode     *node, *child, *refChild, *oldChild, *refNode;
    domNS       *ns;
    domAttrNode *attrs;
    domException exception;
    char         tmp[200], prefix[MAX_PREFIX_LEN], *method, *nodeName,
                 *str, *attr_name, *attr_val, *filter;
    const char  *localName, *uri, *nsStr;
    int          result, length, methodIndex, i, line, column;
    int          nsIndex, bool, hnew, legacy, jsonType;
    Tcl_Obj     *namePtr, *resultPtr;
    Tcl_Obj     *mobjv[MAX_REWRITE_ARGS];
    Tcl_CmdInfo  cmdInfo;
    Tcl_HashEntry *h;

    static const char *nodeMethods[] = {
        "firstChild",      "nextSibling",    "getAttribute",    "nodeName",
        "nodeValue",       "nodeType",       "attributes",      "asList",
        "find",            "setAttribute",   "removeAttribute", "parentNode",
        "previousSibling", "lastChild",      "appendChild",     "removeChild",
        "hasChildNodes",   "localName",      "childNodes",      "ownerDocument",
        "insertBefore",    "replaceChild",   "getLine",         "getColumn",
        "asXML",           "appendFromList", "child",           "fsibling",
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
|   tcldom_DocObjCmd
|
\---------------------------------------------------------------------------*/
int tcldom_DocObjCmd (
    ClientData  clientData,
    Tcl_Interp *interp,
    int         objc,
    Tcl_Obj    *CONST objv[]
)
{
    GetTcldomTSD()

    domDeleteInfo       * dinfo;
    domDocument         * doc;
    char                * method, *tag, *data, *target, *uri, tmp[100];
    char                * str, *docName, *errMsg;
    int                   methodIndex, result, data_length, target_length, i;
    int                   nsIndex, forXPath, bool, setDocumentElement = 0;
    int                   restoreDomCreateCmdMode = 0;
    domNode             * n;
    Tcl_CmdInfo           cmdInfo;
    Tcl_Obj             * mobjv[MAX_REWRITE_ARGS];

    static CONST84 char *docMethods[] = {
        "documentElement", "getElementsByTagName",       "delete",
        "createElement",   "createCDATASection",         "createTextNode",
        "createComment",   "createProcessingInstruction",
        "createElementNS", "getDefaultOutputMethod",     "asXML",
        "asHTML",          "getElementsByTagNameNS",     "xslt", 
        "publicId",        "systemId",                   "internalSubset",
        "toXSLTcmd",       "asText",                     "normalize",







|















|







5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
|   tcldom_DocObjCmd
|
\---------------------------------------------------------------------------*/
int tcldom_DocObjCmd (
    ClientData  clientData,
    Tcl_Interp *interp,
    int         objc,
    Tcl_Obj    *const objv[]
)
{
    GetTcldomTSD()

    domDeleteInfo       * dinfo;
    domDocument         * doc;
    char                * method, *tag, *data, *target, *uri, tmp[100];
    char                * str, *docName, *errMsg;
    int                   methodIndex, result, data_length, target_length, i;
    int                   nsIndex, forXPath, bool, setDocumentElement = 0;
    int                   restoreDomCreateCmdMode = 0;
    domNode             * n;
    Tcl_CmdInfo           cmdInfo;
    Tcl_Obj             * mobjv[MAX_REWRITE_ARGS];

    static const char *docMethods[] = {
        "documentElement", "getElementsByTagName",       "delete",
        "createElement",   "createCDATASection",         "createTextNode",
        "createComment",   "createProcessingInstruction",
        "createElementNS", "getDefaultOutputMethod",     "asXML",
        "asHTML",          "getElementsByTagNameNS",     "xslt", 
        "publicId",        "systemId",                   "internalSubset",
        "toXSLTcmd",       "asText",                     "normalize",
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
    Tcl_Obj    * const objv[]
)
{
    int          setVariable = 0, jsonType = 0, index;
    domDocument *doc;
    Tcl_Obj     *newObjName = NULL;

    static CONST84 char *options[] = {"-jsonType", NULL};
    
    CheckArgs(1,4,1,"?-jsonType jsonType? ?newObjVar?");

    if (objc == 2) {
        newObjName = objv[1];
        setVariable = 1;
    }







|







6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
    Tcl_Obj    * const objv[]
)
{
    int          setVariable = 0, jsonType = 0, index;
    domDocument *doc;
    Tcl_Obj     *newObjName = NULL;

    static const char *options[] = {"-jsonType", NULL};
    
    CheckArgs(1,4,1,"?-jsonType jsonType? ?newObjVar?");

    if (objc == 2) {
        newObjName = objv[1];
        setVariable = 1;
    }
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
{
    GetTcldomTSD()

    char        *xml_string, *option, *errStr, *channelId, *baseURI = NULL;
    char        *jsonRoot = NULL;
    Tcl_Obj     *extResolver = NULL;
    Tcl_Obj     *feedbackCmd = NULL;
    CONST84 char *interpResult;
    int          optionIndex, value, xml_string_len, mode;
    int          jsonmaxnesting = JSON_MAX_NESTING;
    int          ignoreWhiteSpaces   = 1;
    int          takeJSONParser      = 0;
    int          takeSimpleParser    = 0;
    int          takeHTMLParser      = 0;
    int          takeGUMBOParser     = 0;
    int          setVariable         = 0;
    int          ignorexmlns         = 0;
    int          feedbackAfter       = 0;
    int          useForeignDTD       = 0;
    int          paramEntityParsing  = (int)XML_PARAM_ENTITY_PARSING_ALWAYS;
    int          keepCDATA           = 0;
    int          status              = 0;
    domDocument *doc;
    Tcl_Obj     *newObjName = NULL;
    XML_Parser   parser;
    Tcl_Channel  chan = (Tcl_Channel) NULL;
    Tcl_CmdInfo  cmdInfo;

    static CONST84 char *parseOptions[] = {
        "-keepEmpties",           "-simple",        "-html",
        "-feedbackAfter",         "-channel",       "-baseurl",
        "-externalentitycommand", "-useForeignDTD", "-paramentityparsing",
        "-feedbackcmd",           "-json",          "-jsonroot",
#ifdef TDOM_HAVE_GUMBO
        "-html5",
#endif







|




















|







6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
{
    GetTcldomTSD()

    char        *xml_string, *option, *errStr, *channelId, *baseURI = NULL;
    char        *jsonRoot = NULL;
    Tcl_Obj     *extResolver = NULL;
    Tcl_Obj     *feedbackCmd = NULL;
    const char  *interpResult;
    int          optionIndex, value, xml_string_len, mode;
    int          jsonmaxnesting = JSON_MAX_NESTING;
    int          ignoreWhiteSpaces   = 1;
    int          takeJSONParser      = 0;
    int          takeSimpleParser    = 0;
    int          takeHTMLParser      = 0;
    int          takeGUMBOParser     = 0;
    int          setVariable         = 0;
    int          ignorexmlns         = 0;
    int          feedbackAfter       = 0;
    int          useForeignDTD       = 0;
    int          paramEntityParsing  = (int)XML_PARAM_ENTITY_PARSING_ALWAYS;
    int          keepCDATA           = 0;
    int          status              = 0;
    domDocument *doc;
    Tcl_Obj     *newObjName = NULL;
    XML_Parser   parser;
    Tcl_Channel  chan = (Tcl_Channel) NULL;
    Tcl_CmdInfo  cmdInfo;

    static const char *parseOptions[] = {
        "-keepEmpties",           "-simple",        "-html",
        "-feedbackAfter",         "-channel",       "-baseurl",
        "-externalentitycommand", "-useForeignDTD", "-paramentityparsing",
        "-feedbackcmd",           "-json",          "-jsonroot",
#ifdef TDOM_HAVE_GUMBO
        "-html5",
#endif
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
#ifdef TDOM_HAVE_GUMBO
        o_htmlfive,
#endif
        o_jsonmaxnesting,         o_ignorexmlns,    o_LAST,
        o_keepCDATA
    };

    static CONST84 char *paramEntityParsingValues[] = {
        "always",
        "never",
        "notstandalone",
        (char *) NULL
    };
    enum paramEntityParsingValue {
        EXPAT_PARAMENTITYPARSINGALWAYS,







|







6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
#ifdef TDOM_HAVE_GUMBO
        o_htmlfive,
#endif
        o_jsonmaxnesting,         o_ignorexmlns,    o_LAST,
        o_keepCDATA
    };

    static const char *paramEntityParsingValues[] = {
        "always",
        "never",
        "notstandalone",
        (char *) NULL
    };
    enum paramEntityParsingValue {
        EXPAT_PARAMENTITYPARSINGALWAYS,
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
    Tcl_Interp *interp,
    int         objc,
    Tcl_Obj    * const objv[]
)
{
    int featureIndex, result;
    
    static CONST84 char *features[] = {
        "expatversion",      "expatmajorversion",  "expatminorversion",
        "expatmicroversion", "dtd",                "ns",
        "unknown",           "tdomalloc",          "lessns",
        "html5",             "jsonmaxnesting",     "versionhash",
        "TCL_UTF_MAX",        NULL
    };
    enum feature {







|







6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
    Tcl_Interp *interp,
    int         objc,
    Tcl_Obj    * const objv[]
)
{
    int featureIndex, result;
    
    static const char *features[] = {
        "expatversion",      "expatmajorversion",  "expatminorversion",
        "expatmicroversion", "dtd",                "ns",
        "unknown",           "tdomalloc",          "lessns",
        "html5",             "jsonmaxnesting",     "versionhash",
        "TCL_UTF_MAX",        NULL
    };
    enum feature {
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
|   tcldom_DomObjCmd
|
\---------------------------------------------------------------------------*/
int tcldom_DomObjCmd (
    ClientData   clientData,
    Tcl_Interp * interp,
    int          objc,
    Tcl_Obj    * CONST objv[]
)
{
    GetTcldomTSD()

    char        * method, tmp[300];
    int           methodIndex, result, i, bool;
    Tcl_CmdInfo   cmdInfo;
    Tcl_Obj     * mobjv[MAX_REWRITE_ARGS];

    static CONST84 char *domMethods[] = {
        "createDocument",  "createDocumentNS",   "createNodeCmd",
        "parse",           "setResultEncoding",  "setStoreLineColumn",
        "isCharData",      "isName",             "isPIName",
        "isQName",         "isComment",          "isCDATA",
        "isPIValue",       "isNCName",           "createDocumentNode",
        "setNameCheck",    "setTextCheck",       "setObjectCommands",
        "featureinfo",     "isBMPCharData",







|









|







6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
|   tcldom_DomObjCmd
|
\---------------------------------------------------------------------------*/
int tcldom_DomObjCmd (
    ClientData   clientData,
    Tcl_Interp * interp,
    int          objc,
    Tcl_Obj    * const objv[]
)
{
    GetTcldomTSD()

    char        * method, tmp[300];
    int           methodIndex, result, i, bool;
    Tcl_CmdInfo   cmdInfo;
    Tcl_Obj     * mobjv[MAX_REWRITE_ARGS];

    static const char *domMethods[] = {
        "createDocument",  "createDocumentNS",   "createNodeCmd",
        "parse",           "setResultEncoding",  "setStoreLineColumn",
        "isCharData",      "isName",             "isPIName",
        "isQName",         "isComment",          "isCDATA",
        "isPIValue",       "isNCName",           "createDocumentNode",
        "setNameCheck",    "setTextCheck",       "setObjectCommands",
        "featureinfo",     "isBMPCharData",
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
        m_setNameCheck,      m_setTextCheck,       m_setObjectCommands,
        m_featureinfo,       m_isBMPCharData
#ifdef TCL_THREADS
        ,m_attachDocument,   m_detachDocument
#endif
    };

    static CONST84 char *nodeModeValues[] = {
        "automatic", "command", "token", NULL
    };
    enum nodeModeValue {
        v_automatic, v_command, v_token
    };

    if (objc < 2) {







|







6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
        m_setNameCheck,      m_setTextCheck,       m_setObjectCommands,
        m_featureinfo,       m_isBMPCharData
#ifdef TCL_THREADS
        ,m_attachDocument,   m_detachDocument
#endif
    };

    static const char *nodeModeValues[] = {
        "automatic", "command", "token", NULL
    };
    enum nodeModeValue {
        v_automatic, v_command, v_token
    };

    if (objc < 2) {
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
|   tcldom_unknownCmd
|
\---------------------------------------------------------------------------*/
int tcldom_unknownCmd (
    ClientData   clientData,
    Tcl_Interp * interp,
    int          objc,
    Tcl_Obj    * CONST objv[]
)
{
    int          len, i, rc, openedParen, count, args;
    char        *cmd, *dot, *paren, *arg[MAX_REWRITE_ARGS], *object, *method;
    Tcl_DString  callString;
    Tcl_CmdInfo  cmdInfo;
    Tcl_Obj     *vector[2+MAX_REWRITE_ARGS];







|







7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
|   tcldom_unknownCmd
|
\---------------------------------------------------------------------------*/
int tcldom_unknownCmd (
    ClientData   clientData,
    Tcl_Interp * interp,
    int          objc,
    Tcl_Obj    * const objv[]
)
{
    int          len, i, rc, openedParen, count, args;
    char        *cmd, *dot, *paren, *arg[MAX_REWRITE_ARGS], *object, *method;
    Tcl_DString  callString;
    Tcl_CmdInfo  cmdInfo;
    Tcl_Obj     *vector[2+MAX_REWRITE_ARGS];

Changes to generic/tclexpat.c.

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
TDomThreaded(static Tcl_Mutex counterMutex;) /* Protect the counter (zv) */

/*----------------------------------------------------------------------------
|   Prototypes for procedures defined later in this file:
|
\---------------------------------------------------------------------------*/
int             TclExpatObjCmd (ClientData dummy,
                    Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
static int      TclExpatInstanceCmd (ClientData dummy,
                    Tcl_Interp *interp, int objc, struct Tcl_Obj *CONST objv[]);
static void     TclExpatDeleteCmd (ClientData clientData);

static Tcl_Obj* FindUniqueCmdName (Tcl_Interp *interp);
static int      TclExpatCheckWhiteData (char *pc, int len);

static int      TclExpatInitializeParser (Tcl_Interp *interp,
                    TclGenExpatInfo *expat, int resetOptions );
static void     TclExpatFreeParser  (TclGenExpatInfo *expat);
static int      TclExpatParse (Tcl_Interp *interp,
                    TclGenExpatInfo *expat, char *data, int len,
                               TclExpat_InputType type);
static int      TclExpatConfigure (Tcl_Interp *interp,
                    TclGenExpatInfo *expat, int objc, Tcl_Obj *CONST objv[]);
static int      TclExpatCget (Tcl_Interp *interp,
                    TclGenExpatInfo *expat, int objc, Tcl_Obj *CONST objv[]);

static int	TclExpatGet (Tcl_Interp *interp,
		    TclGenExpatInfo *expat, int objc, Tcl_Obj *CONST objv[]);
static void	TclExpatDispatchPCDATA (TclGenExpatInfo *expat);
static void TclGenExpatElementStartHandler (void *userdata,
                                            const XML_Char *name,
                                            const XML_Char **atts);
static void TclGenExpatElementEndHandler (void *userData,
                                          const XML_Char *name);
static void TclGenExpatCharacterDataHandler (void *userData,







|

|












|

|


|







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
TDomThreaded(static Tcl_Mutex counterMutex;) /* Protect the counter (zv) */

/*----------------------------------------------------------------------------
|   Prototypes for procedures defined later in this file:
|
\---------------------------------------------------------------------------*/
int             TclExpatObjCmd (ClientData dummy,
                    Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
static int      TclExpatInstanceCmd (ClientData dummy,
                    Tcl_Interp *interp, int objc, struct Tcl_Obj *const objv[]);
static void     TclExpatDeleteCmd (ClientData clientData);

static Tcl_Obj* FindUniqueCmdName (Tcl_Interp *interp);
static int      TclExpatCheckWhiteData (char *pc, int len);

static int      TclExpatInitializeParser (Tcl_Interp *interp,
                    TclGenExpatInfo *expat, int resetOptions );
static void     TclExpatFreeParser  (TclGenExpatInfo *expat);
static int      TclExpatParse (Tcl_Interp *interp,
                    TclGenExpatInfo *expat, char *data, int len,
                               TclExpat_InputType type);
static int      TclExpatConfigure (Tcl_Interp *interp,
                    TclGenExpatInfo *expat, int objc, Tcl_Obj *const objv[]);
static int      TclExpatCget (Tcl_Interp *interp,
                    TclGenExpatInfo *expat, int objc, Tcl_Obj *const objv[]);

static int	TclExpatGet (Tcl_Interp *interp,
		    TclGenExpatInfo *expat, int objc, Tcl_Obj *const objv[]);
static void	TclExpatDispatchPCDATA (TclGenExpatInfo *expat);
static void TclGenExpatElementStartHandler (void *userdata,
                                            const XML_Char *name,
                                            const XML_Char **atts);
static void TclGenExpatElementEndHandler (void *userData,
                                          const XML_Char *name);
static void TclGenExpatCharacterDataHandler (void *userData,
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
                                           const XML_Char *encoding,
					   int standalone);
static void     TclGenExpatEntityDeclHandler (void *userData,
                                              const XML_Char *entityname,
                                              int is_param,
                                              const XML_Char *value,
                                              int length,
                                              CONST XML_Char *base,
                                              CONST XML_Char *systemId,
                                              CONST XML_Char *publicId,
					      CONST XML_Char *notationName);

/*
 *----------------------------------------------------------------------------
 *
 * CreateTclHandlerSet --
 *
 *	Malloc's and initializes a tclHandlerSet.







|
|
|
|







200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
                                           const XML_Char *encoding,
					   int standalone);
static void     TclGenExpatEntityDeclHandler (void *userData,
                                              const XML_Char *entityname,
                                              int is_param,
                                              const XML_Char *value,
                                              int length,
                                              const XML_Char *base,
                                              const XML_Char *systemId,
                                              const XML_Char *publicId,
					      const XML_Char *notationName);

/*
 *----------------------------------------------------------------------------
 *
 * CreateTclHandlerSet --
 *
 *	Malloc's and initializes a tclHandlerSet.
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
 */

int
TclExpatObjCmd(
    ClientData dummy,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *CONST objv[]
) {
  TclGenExpatInfo *genexpat;
  int ns_mode = 0;
  char *nsoption;


  /*







|







337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
 */

int
TclExpatObjCmd(
    ClientData dummy,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[]
) {
  TclGenExpatInfo *genexpat;
  int ns_mode = 0;
  char *nsoption;


  /*
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
 *	Stores the markup context in expapt->currentmarkup.
 *
 *----------------------------------------------------------------------------
 */
static void
CurrentmarkupCommand (
    void *userData,
    CONST char *s,
    int len
) {
    TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;

    if (expat->status != TCL_OK) {
        return;
    }







|







650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
 *	Stores the markup context in expapt->currentmarkup.
 *
 *----------------------------------------------------------------------------
 */
static void
CurrentmarkupCommand (
    void *userData,
    const char *s,
    int len
) {
    TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;

    if (expat->status != TCL_OK) {
        return;
    }
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
 */

static int
TclExpatInstanceCmd (
    ClientData clientData,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *CONST objv[]
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) clientData;
  char *data;
  int len = 0, optionIndex, result = TCL_OK;

  static CONST84 char *options[] = {
      "configure", "cget", "currentmarkup", "free", "get",
      "parse", "parsechannel", "parsefile", "reset", "delete",
      NULL
  };
  enum options {
      EXPAT_CONFIGURE, EXPAT_CGET, EXPAT_CURRENTMARKUP, EXPAT_FREE, EXPAT_GET,
      EXPAT_PARSE, EXPAT_PARSECHANNEL, EXPAT_PARSEFILE, EXPAT_RESET,







|





|







697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
 */

static int
TclExpatInstanceCmd (
    ClientData clientData,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[]
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) clientData;
  char *data;
  int len = 0, optionIndex, result = TCL_OK;

  static const char *options[] = {
      "configure", "cget", "currentmarkup", "free", "get",
      "parse", "parsechannel", "parsefile", "reset", "delete",
      NULL
  };
  enum options {
      EXPAT_CONFIGURE, EXPAT_CGET, EXPAT_CURRENTMARKUP, EXPAT_FREE, EXPAT_GET,
      EXPAT_PARSE, EXPAT_PARSECHANNEL, EXPAT_PARSEFILE, EXPAT_RESET,
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
 */

static int
TclExpatConfigure (
    Tcl_Interp *interp,
    TclGenExpatInfo *expat,
    int objc,
    Tcl_Obj *CONST objv[]
) {
  static CONST84 char *switches[] = {
    "-final",
    "-baseurl",
    "-elementstartcommand",
    "-elementendcommand",
    "-characterdatacommand",
    "-processinginstructioncommand",
    "-defaultcommand",







|

|







1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
 */

static int
TclExpatConfigure (
    Tcl_Interp *interp,
    TclGenExpatInfo *expat,
    int objc,
    Tcl_Obj *const objv[]
) {
  static const char *switches[] = {
    "-final",
    "-baseurl",
    "-elementstartcommand",
    "-elementendcommand",
    "-characterdatacommand",
    "-processinginstructioncommand",
    "-defaultcommand",
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
    EXPAT_XMLDECLCMD,
    EXPAT_PARAMENTITYPARSING,
    EXPAT_ENTITYDECLCOMMAND,
    EXPAT_NOWHITESPACE,
    EXPAT_HANDLERSET,
    EXPAT_NOEXPAND
  };
  static CONST84 char *paramEntityParsingValues[] = {
      "always",
      "never",
      "notstandalone",
      (char *) NULL
  };
  enum paramEntityParsingValues {
      EXPAT_PARAMENTITYPARSINGALWAYS,
      EXPAT_PARAMENTITYPARSINGNEVER,
      EXPAT_PARAMENTITYPARSINGNOTSTANDALONE
  };
  int optionIndex, value, bool;
  Tcl_Obj *CONST *objPtr = objv;
  Tcl_CmdInfo cmdInfo;
  int rc;
  char *handlerSetName = NULL;
  TclHandlerSet *tmpTclHandlerSet, *activeTclHandlerSet = NULL;

  if (expat->firstTclHandlerSet 
      && (strcmp ("default", expat->firstTclHandlerSet->name)==0)) {







|











|







1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
    EXPAT_XMLDECLCMD,
    EXPAT_PARAMENTITYPARSING,
    EXPAT_ENTITYDECLCOMMAND,
    EXPAT_NOWHITESPACE,
    EXPAT_HANDLERSET,
    EXPAT_NOEXPAND
  };
  static const char *paramEntityParsingValues[] = {
      "always",
      "never",
      "notstandalone",
      (char *) NULL
  };
  enum paramEntityParsingValues {
      EXPAT_PARAMENTITYPARSINGALWAYS,
      EXPAT_PARAMENTITYPARSINGNEVER,
      EXPAT_PARAMENTITYPARSINGNOTSTANDALONE
  };
  int optionIndex, value, bool;
  Tcl_Obj *const *objPtr = objv;
  Tcl_CmdInfo cmdInfo;
  int rc;
  char *handlerSetName = NULL;
  TclHandlerSet *tmpTclHandlerSet, *activeTclHandlerSet = NULL;

  if (expat->firstTclHandlerSet 
      && (strcmp ("default", expat->firstTclHandlerSet->name)==0)) {
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
 */

static int
TclExpatCget (
    Tcl_Interp *interp,
    TclGenExpatInfo *expat,
    int objc,
    Tcl_Obj *CONST objv[]
) {
    static CONST84 char *switches[] = {
        "-final",
        "-baseurl",
        "-elementstartcommand",
        "-elementendcommand",
        "-characterdatacommand",
        "-processinginstructioncommand",
        "-defaultcommand",







|

|







1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
 */

static int
TclExpatCget (
    Tcl_Interp *interp,
    TclGenExpatInfo *expat,
    int objc,
    Tcl_Obj *const objv[]
) {
    static const char *switches[] = {
        "-final",
        "-baseurl",
        "-elementstartcommand",
        "-elementendcommand",
        "-characterdatacommand",
        "-processinginstructioncommand",
        "-defaultcommand",
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
 *----------------------------------------------------------------------------
 */
static int
TclExpatGet (
    Tcl_Interp *interp,
    TclGenExpatInfo *expat,
    int objc,
    Tcl_Obj *CONST objv[]
)
{
  static CONST84 char *getSwitches[] = {
    "-specifiedattributecount",
    "-currentbytecount",
    "-currentlinenumber",
    "-currentcolumnnumber",
    "-currentbyteindex",
    (char *) NULL
  };







|


|







1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
 *----------------------------------------------------------------------------
 */
static int
TclExpatGet (
    Tcl_Interp *interp,
    TclGenExpatInfo *expat,
    int objc,
    Tcl_Obj *const objv[]
)
{
  static const char *getSwitches[] = {
    "-specifiedattributecount",
    "-currentbytecount",
    "-currentlinenumber",
    "-currentcolumnnumber",
    "-currentbyteindex",
    (char *) NULL
  };
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
 *
 *----------------------------------------------------------------------------
 */

static void
TclGenExpatElementEndHandler(
    void *userData,
    CONST char *name
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;
  int result;
  Tcl_Obj *vector[2], *ename = NULL;
  TclHandlerSet *activeTclHandlerSet;
  CHandlerSet *activeCHandlerSet;
  Tcl_Obj      *cmdPtr;







|







2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
 *
 *----------------------------------------------------------------------------
 */

static void
TclGenExpatElementEndHandler(
    void *userData,
    const char *name
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;
  int result;
  Tcl_Obj *vector[2], *ename = NULL;
  TclHandlerSet *activeTclHandlerSet;
  CHandlerSet *activeCHandlerSet;
  Tcl_Obj      *cmdPtr;
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
 *
 *----------------------------------------------------------------------------
 */

static void
TclGenExpatEndNamespaceDeclHandler(
    void       *userData,
    CONST char *prefix
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;
  Tcl_Obj *cmdPtr;
  int result;
  TclHandlerSet *activeTclHandlerSet;
  CHandlerSet *activeCHandlerSet;








|







2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
 *
 *----------------------------------------------------------------------------
 */

static void
TclGenExpatEndNamespaceDeclHandler(
    void       *userData,
    const char *prefix
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;
  Tcl_Obj *cmdPtr;
  int result;
  TclHandlerSet *activeTclHandlerSet;
  CHandlerSet *activeCHandlerSet;

2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
 *
 *----------------------------------------------------------------------------
 */

static void
TclGenExpatCharacterDataHandler(
    void *userData,
    CONST char *s,
    int len
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;

  if (expat->status != TCL_OK) {
      return;
  }







|







2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
 *
 *----------------------------------------------------------------------------
 */

static void
TclGenExpatCharacterDataHandler(
    void *userData,
    const char *s,
    int len
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;

  if (expat->status != TCL_OK) {
      return;
  }
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
 *
 *----------------------------------------------------------------------------
 */

static void
TclGenExpatProcessingInstructionHandler(
    void *userData,
    CONST char *target,
    CONST char *data
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;
  Tcl_Obj *cmdPtr;
  int result;
  TclHandlerSet *activeTclHandlerSet;
  CHandlerSet *activeCHandlerSet;








|
|







2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
 *
 *----------------------------------------------------------------------------
 */

static void
TclGenExpatProcessingInstructionHandler(
    void *userData,
    const char *target,
    const char *data
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;
  Tcl_Obj *cmdPtr;
  int result;
  TclHandlerSet *activeTclHandlerSet;
  CHandlerSet *activeCHandlerSet;

2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
 *
 *----------------------------------------------------------------------------
 */

static void
TclGenExpatDefaultHandler(
    void *userData,
    CONST char *s,
    int len
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;
  Tcl_Obj *cmdPtr;
  int result;
  TclHandlerSet *activeTclHandlerSet;
  CHandlerSet *activeCHandlerSet;







|







2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
 *
 *----------------------------------------------------------------------------
 */

static void
TclGenExpatDefaultHandler(
    void *userData,
    const char *s,
    int len
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;
  Tcl_Obj *cmdPtr;
  int result;
  TclHandlerSet *activeTclHandlerSet;
  CHandlerSet *activeCHandlerSet;
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
 *
 *----------------------------------------------------------------------------
 */

static void
TclGenExpatEntityDeclHandler(
    void *userData,
    CONST char *entityname,
    int         is_param,
    CONST char *value,
    int         length,
    CONST char *base,
    CONST char *systemId,
    CONST char *publicId,
    CONST char *notationName
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;
  Tcl_Obj *cmdPtr;
  int result;
  TclHandlerSet *activeTclHandlerSet;
  CHandlerSet *activeCHandlerSet;








|

|

|
|
|
|







2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
 *
 *----------------------------------------------------------------------------
 */

static void
TclGenExpatEntityDeclHandler(
    void *userData,
    const char *entityname,
    int         is_param,
    const char *value,
    int         length,
    const char *base,
    const char *systemId,
    const char *publicId,
    const char *notationName
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;
  Tcl_Obj *cmdPtr;
  int result;
  TclHandlerSet *activeTclHandlerSet;
  CHandlerSet *activeCHandlerSet;

3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
 *
 *----------------------------------------------------------------------------
 */

static void
TclGenExpatNotationDeclHandler(
    void *userData,
    CONST char *notationName,
    CONST char *base,
    CONST char *systemId,
    CONST char *publicId
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;
  Tcl_Obj *cmdPtr;
  int result;
  TclHandlerSet *activeTclHandlerSet;
  CHandlerSet *activeCHandlerSet;








|
|
|
|







3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
 *
 *----------------------------------------------------------------------------
 */

static void
TclGenExpatNotationDeclHandler(
    void *userData,
    const char *notationName,
    const char *base,
    const char *systemId,
    const char *publicId
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) userData;
  Tcl_Obj *cmdPtr;
  int result;
  TclHandlerSet *activeTclHandlerSet;
  CHandlerSet *activeCHandlerSet;

3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
 *
 *----------------------------------------------------------------------------
 */

static int
TclGenExpatUnknownEncodingHandler(
    void *encodingHandlerData,
    CONST char *name,
    XML_Encoding *info
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) encodingHandlerData;
  CHandlerSet *activeCHandlerSet;

  TclExpatDispatchPCDATA(expat);








|







3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
 *
 *----------------------------------------------------------------------------
 */

static int
TclGenExpatUnknownEncodingHandler(
    void *encodingHandlerData,
    const char *name,
    XML_Encoding *info
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) encodingHandlerData;
  CHandlerSet *activeCHandlerSet;

  TclExpatDispatchPCDATA(expat);

3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
 *	Callback scripts are invoked.
 *
 *----------------------------------------------------------------------------
 */
static int
TclGenExpatExternalEntityRefHandler(
    XML_Parser parser,
    CONST char *openEntityNames,
    CONST char *base,
    CONST char *systemId,
    CONST char *publicId
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) XML_GetUserData(parser);
  Tcl_Obj *cmdPtr, *resultObj, *resultTypeObj, *extbaseObj, *dataObj;
  int result, mode, done, fd, tclLen;
  size_t len;
  TclHandlerSet *activeTclHandlerSet;
  CHandlerSet *activeCHandlerSet;







|
|
|
|







3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
 *	Callback scripts are invoked.
 *
 *----------------------------------------------------------------------------
 */
static int
TclGenExpatExternalEntityRefHandler(
    XML_Parser parser,
    const char *openEntityNames,
    const char *base,
    const char *systemId,
    const char *publicId
) {
  TclGenExpatInfo *expat = (TclGenExpatInfo *) XML_GetUserData(parser);
  Tcl_Obj *cmdPtr, *resultObj, *resultTypeObj, *extbaseObj, *dataObj;
  int result, mode, done, fd, tclLen;
  size_t len;
  TclHandlerSet *activeTclHandlerSet;
  CHandlerSet *activeCHandlerSet;
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
  FREE( (char*) expat);
}


int
CheckExpatParserObj (
    Tcl_Interp *interp,
    Tcl_Obj *CONST nameObj
) {
    Tcl_CmdInfo info;

    if (!Tcl_GetCommandInfo (interp, Tcl_GetString(nameObj), &info)) {
        return 0;
    }
    if (!info.isNativeObjectProc || info.objProc != TclExpatInstanceCmd) {
        return 0;
    }
    return 1;
}

int
CHandlerSetInstall (
    Tcl_Interp *interp,
    Tcl_Obj *CONST expatObj,
    CHandlerSet *handlerSet
) {
    Tcl_CmdInfo info;
    TclGenExpatInfo *expat;
    CHandlerSet *activeCHandlerSet;

    if (!Tcl_GetCommandInfo (interp, Tcl_GetString(expatObj), &info)) {







|















|







4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
  FREE( (char*) expat);
}


int
CheckExpatParserObj (
    Tcl_Interp *interp,
    Tcl_Obj *const nameObj
) {
    Tcl_CmdInfo info;

    if (!Tcl_GetCommandInfo (interp, Tcl_GetString(nameObj), &info)) {
        return 0;
    }
    if (!info.isNativeObjectProc || info.objProc != TclExpatInstanceCmd) {
        return 0;
    }
    return 1;
}

int
CHandlerSetInstall (
    Tcl_Interp *interp,
    Tcl_Obj *const expatObj,
    CHandlerSet *handlerSet
) {
    Tcl_CmdInfo info;
    TclGenExpatInfo *expat;
    CHandlerSet *activeCHandlerSet;

    if (!Tcl_GetCommandInfo (interp, Tcl_GetString(expatObj), &info)) {
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
    }
    return 0;
}

int
CHandlerSetRemove (
    Tcl_Interp *interp,
    Tcl_Obj *CONST expatObj,
    char *handlerSetName
) {
    Tcl_CmdInfo info;
    TclGenExpatInfo *expat;
    CHandlerSet *activeCHandlerSet, *parentHandlerSet = NULL;

    if (!Tcl_GetCommandInfo (interp, Tcl_GetString(expatObj), &info)) {







|







4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
    }
    return 0;
}

int
CHandlerSetRemove (
    Tcl_Interp *interp,
    Tcl_Obj *const expatObj,
    char *handlerSetName
) {
    Tcl_CmdInfo info;
    TclGenExpatInfo *expat;
    CHandlerSet *activeCHandlerSet, *parentHandlerSet = NULL;

    if (!Tcl_GetCommandInfo (interp, Tcl_GetString(expatObj), &info)) {
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
    }
    return 2;
}

CHandlerSet *
CHandlerSetGet (
    Tcl_Interp *interp,
    Tcl_Obj *CONST expatObj,
    char *handlerSetName
) {
    Tcl_CmdInfo info;
    TclGenExpatInfo *expat;
    CHandlerSet *activeCHandlerSet;

    if (!Tcl_GetCommandInfo (interp, Tcl_GetString(expatObj), &info)) {







|







4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
    }
    return 2;
}

CHandlerSet *
CHandlerSetGet (
    Tcl_Interp *interp,
    Tcl_Obj *const expatObj,
    char *handlerSetName
) {
    Tcl_CmdInfo info;
    TclGenExpatInfo *expat;
    CHandlerSet *activeCHandlerSet;

    if (!Tcl_GetCommandInfo (interp, Tcl_GetString(expatObj), &info)) {
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
    }
    return NULL;
}

void *
CHandlerSetGetUserData (
    Tcl_Interp *interp,
    Tcl_Obj *CONST expatObj,
    char *handlerSetName
) {
    Tcl_CmdInfo info;
    TclGenExpatInfo *expat;
    CHandlerSet *activeCHandlerSet;

    if (!Tcl_GetCommandInfo (interp, Tcl_GetString(expatObj), &info)) {







|







4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
    }
    return NULL;
}

void *
CHandlerSetGetUserData (
    Tcl_Interp *interp,
    Tcl_Obj *const expatObj,
    char *handlerSetName
) {
    Tcl_CmdInfo info;
    TclGenExpatInfo *expat;
    CHandlerSet *activeCHandlerSet;

    if (!Tcl_GetCommandInfo (interp, Tcl_GetString(expatObj), &info)) {
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
    }
    return NULL;
}

TclGenExpatInfo *
GetExpatInfo (
    Tcl_Interp *interp,
    Tcl_Obj *CONST expatObj
) {
    Tcl_CmdInfo info;
    if (!Tcl_GetCommandInfo (interp, Tcl_GetString(expatObj), &info)) {
        return NULL;
    }
    return (TclGenExpatInfo *) info.objClientData;
}







|







4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
    }
    return NULL;
}

TclGenExpatInfo *
GetExpatInfo (
    Tcl_Interp *interp,
    Tcl_Obj *const expatObj
) {
    Tcl_CmdInfo info;
    if (!Tcl_GetCommandInfo (interp, Tcl_GetString(expatObj), &info)) {
        return NULL;
    }
    return (TclGenExpatInfo *) info.objClientData;
}

Changes to generic/tclexpat.h.

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
    int parsingState;           /* 0 == freshly (re-)initialized
                                   1 == initParserProcs called
                                   2 == parsing an input chunk */
    XML_Char nsSeparator;       
    int paramentityparsing;     
    int noexpand;
    int useForeignDTD;
    CONST char *currentmarkup;  /* Used to transfer data for method */
    int currentmarkuplen;       /* currentmarkup */
 
    TclHandlerSet *firstTclHandlerSet;
    CHandlerSet *firstCHandlerSet;
} TclGenExpatInfo;

/*--------------------------------------------------------------------------
|   Function prototypes
|
\-------------------------------------------------------------------------*/

#if defined(_MSC_VER) || defined(BUILD_tdom) || defined(__MINGW32__) 
#  undef TCL_STORAGE_CLASS
#  define TCL_STORAGE_CLASS DLLEXPORT
#endif

EXTERN Tcl_ObjCmdProc TclExpatObjCmd;

EXTERN int CheckExpatParserObj (Tcl_Interp *interp,
				Tcl_Obj *CONST nameObj);
EXTERN int CHandlerSetInstall (Tcl_Interp *interp,
			       Tcl_Obj *CONST expatObj,
			       CHandlerSet *handlerSet);
EXTERN int CHandlerSetRemove (Tcl_Interp *interp,
			      Tcl_Obj *CONST expatObj,
			      char *handlerSetName);
EXTERN CHandlerSet * CHandlerSetCreate (char *name);
EXTERN CHandlerSet * CHandlerSetGet (Tcl_Interp *interp,
                                     Tcl_Obj *CONST expatObj,
				     char *handlerSetName);
EXTERN void * CHandlerSetGetUserData (Tcl_Interp *interp,
                                      Tcl_Obj *CONST expatObj,
				      char *handlerSetName);

EXTERN TclGenExpatInfo * GetExpatInfo (Tcl_Interp *interp,
				       Tcl_Obj *CONST expatObj);







|



















|

|


|



|


|



|
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
    int parsingState;           /* 0 == freshly (re-)initialized
                                   1 == initParserProcs called
                                   2 == parsing an input chunk */
    XML_Char nsSeparator;       
    int paramentityparsing;     
    int noexpand;
    int useForeignDTD;
    const char *currentmarkup;  /* Used to transfer data for method */
    int currentmarkuplen;       /* currentmarkup */
 
    TclHandlerSet *firstTclHandlerSet;
    CHandlerSet *firstCHandlerSet;
} TclGenExpatInfo;

/*--------------------------------------------------------------------------
|   Function prototypes
|
\-------------------------------------------------------------------------*/

#if defined(_MSC_VER) || defined(BUILD_tdom) || defined(__MINGW32__) 
#  undef TCL_STORAGE_CLASS
#  define TCL_STORAGE_CLASS DLLEXPORT
#endif

EXTERN Tcl_ObjCmdProc TclExpatObjCmd;

EXTERN int CheckExpatParserObj (Tcl_Interp *interp,
				Tcl_Obj *const nameObj);
EXTERN int CHandlerSetInstall (Tcl_Interp *interp,
			       Tcl_Obj *const expatObj,
			       CHandlerSet *handlerSet);
EXTERN int CHandlerSetRemove (Tcl_Interp *interp,
			      Tcl_Obj *const expatObj,
			      char *handlerSetName);
EXTERN CHandlerSet * CHandlerSetCreate (char *name);
EXTERN CHandlerSet * CHandlerSetGet (Tcl_Interp *interp,
                                     Tcl_Obj *const expatObj,
				     char *handlerSetName);
EXTERN void * CHandlerSetGetUserData (Tcl_Interp *interp,
                                      Tcl_Obj *const expatObj,
				      char *handlerSetName);

EXTERN TclGenExpatInfo * GetExpatInfo (Tcl_Interp *interp,
				       Tcl_Obj *const expatObj);

Changes to generic/tclpull.h.

1
2
3

int tDOM_PullParserCmd (ClientData dummy, Tcl_Interp *interp, int objc,
                        Tcl_Obj *CONST objv[]);


|
1
2
3

int tDOM_PullParserCmd (ClientData dummy, Tcl_Interp *interp, int objc,
                        Tcl_Obj *const objv[]);

Changes to generic/tdom.decls.

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
# tdom.decls --
#
#	This file contains the declarations for all supported public
#	functions that are exported by the tDOM library via the stubs table.
#
# Copyright (c) 2002 Rolf Ade.

library tdom
interface tdom
#hooks {}

declare 0 generic {
    int TclExpatObjCmd (ClientData dummy, Tcl_Interp *interp, 
                        int objc, Tcl_Obj *CONST objv[])
}
declare 1 generic {
    int CheckExpatParserObj (Tcl_Interp *interp, Tcl_Obj *CONST nameObj)
}
declare 2 generic {
     int CHandlerSetInstall (Tcl_Interp *interp, Tcl_Obj *CONST expatObj,
                             CHandlerSet *handlerSet)
}
declare 3 generic {
     int CHandlerSetRemove (Tcl_Interp *interp, Tcl_Obj *CONST expatObj,
                            char *handlerSetName)
}
declare 4 generic {
     CHandlerSet * CHandlerSetCreate (char *name)
}
declare 5 generic {
     CHandlerSet * CHandlerSetGet (Tcl_Interp *interp, Tcl_Obj *CONST expatObj,
                                   char *handlerSetName)
}
declare 6 generic {
     void * CHandlerSetGetUserData (Tcl_Interp *interp, 
                                    Tcl_Obj *CONST expatObj,
                                    char *handlerSetName)
}
declare 7 generic {
     TclGenExpatInfo * GetExpatInfo (Tcl_Interp *interp,
                                     Tcl_Obj *CONST expatObj)
}
declare 8 generic {
     XML_Size XML_GetCurrentLineNumber(XML_Parser parser)
}
declare 9 generic {
     XML_Size XML_GetCurrentColumnNumber(XML_Parser parser)
}













|


|


|



|






|




|




|







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
# tdom.decls --
#
#	This file contains the declarations for all supported public
#	functions that are exported by the tDOM library via the stubs table.
#
# Copyright (c) 2002 Rolf Ade.

library tdom
interface tdom
#hooks {}

declare 0 generic {
    int TclExpatObjCmd (ClientData dummy, Tcl_Interp *interp, 
                        int objc, Tcl_Obj *const objv[])
}
declare 1 generic {
    int CheckExpatParserObj (Tcl_Interp *interp, Tcl_Obj *const nameObj)
}
declare 2 generic {
     int CHandlerSetInstall (Tcl_Interp *interp, Tcl_Obj *const expatObj,
                             CHandlerSet *handlerSet)
}
declare 3 generic {
     int CHandlerSetRemove (Tcl_Interp *interp, Tcl_Obj *const expatObj,
                            char *handlerSetName)
}
declare 4 generic {
     CHandlerSet * CHandlerSetCreate (char *name)
}
declare 5 generic {
     CHandlerSet * CHandlerSetGet (Tcl_Interp *interp, Tcl_Obj *const expatObj,
                                   char *handlerSetName)
}
declare 6 generic {
     void * CHandlerSetGetUserData (Tcl_Interp *interp, 
                                    Tcl_Obj *const expatObj,
                                    char *handlerSetName)
}
declare 7 generic {
     TclGenExpatInfo * GetExpatInfo (Tcl_Interp *interp,
                                     Tcl_Obj *const expatObj)
}
declare 8 generic {
     XML_Size XML_GetCurrentLineNumber(XML_Parser parser)
}
declare 9 generic {
     XML_Size XML_GetCurrentColumnNumber(XML_Parser parser)
}

Changes to generic/tdomDecls.h.

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

/*
 * Exported function declarations:
 */

/* 0 */
EXTERN int		TclExpatObjCmd(ClientData dummy, Tcl_Interp *interp,
				int objc, Tcl_Obj *CONST objv[]);
/* 1 */
EXTERN int		CheckExpatParserObj(Tcl_Interp *interp,
				Tcl_Obj *CONST nameObj);
/* 2 */
EXTERN int		CHandlerSetInstall(Tcl_Interp *interp,
				Tcl_Obj *CONST expatObj, 
				CHandlerSet *handlerSet);
/* 3 */
EXTERN int		CHandlerSetRemove(Tcl_Interp *interp,
				Tcl_Obj *CONST expatObj, 
				char *handlerSetName);
/* 4 */
EXTERN CHandlerSet *	CHandlerSetCreate(char *name);
/* 5 */
EXTERN CHandlerSet *	CHandlerSetGet(Tcl_Interp *interp,
				Tcl_Obj *CONST expatObj, 
				char *handlerSetName);
/* 6 */
EXTERN void *		CHandlerSetGetUserData(Tcl_Interp *interp,
				Tcl_Obj *CONST expatObj,
				char *handlerSetName);
/* 7 */
EXTERN TclGenExpatInfo * GetExpatInfo(Tcl_Interp *interp,
				Tcl_Obj *CONST expatObj);
/* 8 */
EXTERN XML_Size		XML_GetCurrentLineNumber(XML_Parser parser);
/* 9 */
EXTERN XML_Size		XML_GetCurrentColumnNumber(XML_Parser parser);
/* 10 */
EXTERN XML_Index	XML_GetCurrentByteIndex(XML_Parser parser);
/* 11 */







|


|


|



|





|



|



|







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

/*
 * Exported function declarations:
 */

/* 0 */
EXTERN int		TclExpatObjCmd(ClientData dummy, Tcl_Interp *interp,
				int objc, Tcl_Obj *const objv[]);
/* 1 */
EXTERN int		CheckExpatParserObj(Tcl_Interp *interp,
				Tcl_Obj *const nameObj);
/* 2 */
EXTERN int		CHandlerSetInstall(Tcl_Interp *interp,
				Tcl_Obj *const expatObj, 
				CHandlerSet *handlerSet);
/* 3 */
EXTERN int		CHandlerSetRemove(Tcl_Interp *interp,
				Tcl_Obj *const expatObj, 
				char *handlerSetName);
/* 4 */
EXTERN CHandlerSet *	CHandlerSetCreate(char *name);
/* 5 */
EXTERN CHandlerSet *	CHandlerSetGet(Tcl_Interp *interp,
				Tcl_Obj *const expatObj, 
				char *handlerSetName);
/* 6 */
EXTERN void *		CHandlerSetGetUserData(Tcl_Interp *interp,
				Tcl_Obj *const expatObj,
				char *handlerSetName);
/* 7 */
EXTERN TclGenExpatInfo * GetExpatInfo(Tcl_Interp *interp,
				Tcl_Obj *const expatObj);
/* 8 */
EXTERN XML_Size		XML_GetCurrentLineNumber(XML_Parser parser);
/* 9 */
EXTERN XML_Size		XML_GetCurrentColumnNumber(XML_Parser parser);
/* 10 */
EXTERN XML_Index	XML_GetCurrentByteIndex(XML_Parser parser);
/* 11 */
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
EXTERN domDocument *	tcldom_getDocumentFromName(Tcl_Interp *interp,
				char *docName, char **errMsg);

typedef struct TdomStubs {
    int magic;
    void *hooks;

    int (*tclExpatObjCmd) (ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); /* 0 */
    int (*checkExpatParserObj) (Tcl_Interp *interp, Tcl_Obj *CONST nameObj); /* 1 */
    int (*cHandlerSetInstall) (Tcl_Interp *interp, Tcl_Obj *CONST expatObj, CHandlerSet *handlerSet); /* 2 */
    int (*cHandlerSetRemove) (Tcl_Interp *interp, Tcl_Obj *CONST expatObj, char *handlerSetName); /* 3 */
    CHandlerSet * (*cHandlerSetCreate) (char *name); /* 4 */
    CHandlerSet * (*cHandlerSetGet) (Tcl_Interp *interp, Tcl_Obj *CONST expatObj, char *handlerSetName); /* 5 */
    void * (*cHandlerSetGetUserData) (Tcl_Interp *interp, Tcl_Obj *CONST expatObj, char *handlerSetName); /* 6 */
    TclGenExpatInfo * (*getExpatInfo) (Tcl_Interp *interp, Tcl_Obj *CONST expatObj); /* 7 */
    XML_Size (*xML_GetCurrentLineNumber) (XML_Parser parser); /* 8 */
    XML_Size (*xML_GetCurrentColumnNumber) (XML_Parser parser); /* 9 */
    XML_Index (*xML_GetCurrentByteIndex) (XML_Parser parser); /* 10 */
    int (*xML_GetCurrentByteCount) (XML_Parser parser); /* 11 */
    enum XML_Status (*xML_SetBase) (XML_Parser parser, const XML_Char *base); /* 12 */
    const XML_Char * (*xML_GetBase) (XML_Parser parser); /* 13 */
    int (*xML_GetSpecifiedAttributeCount) (XML_Parser parser); /* 14 */







|
|
|
|

|
|
|







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
EXTERN domDocument *	tcldom_getDocumentFromName(Tcl_Interp *interp,
				char *docName, char **errMsg);

typedef struct TdomStubs {
    int magic;
    void *hooks;

    int (*tclExpatObjCmd) (ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 0 */
    int (*checkExpatParserObj) (Tcl_Interp *interp, Tcl_Obj *const nameObj); /* 1 */
    int (*cHandlerSetInstall) (Tcl_Interp *interp, Tcl_Obj *const expatObj, CHandlerSet *handlerSet); /* 2 */
    int (*cHandlerSetRemove) (Tcl_Interp *interp, Tcl_Obj *const expatObj, char *handlerSetName); /* 3 */
    CHandlerSet * (*cHandlerSetCreate) (char *name); /* 4 */
    CHandlerSet * (*cHandlerSetGet) (Tcl_Interp *interp, Tcl_Obj *const expatObj, char *handlerSetName); /* 5 */
    void * (*cHandlerSetGetUserData) (Tcl_Interp *interp, Tcl_Obj *const expatObj, char *handlerSetName); /* 6 */
    TclGenExpatInfo * (*getExpatInfo) (Tcl_Interp *interp, Tcl_Obj *const expatObj); /* 7 */
    XML_Size (*xML_GetCurrentLineNumber) (XML_Parser parser); /* 8 */
    XML_Size (*xML_GetCurrentColumnNumber) (XML_Parser parser); /* 9 */
    XML_Index (*xML_GetCurrentByteIndex) (XML_Parser parser); /* 10 */
    int (*xML_GetCurrentByteCount) (XML_Parser parser); /* 11 */
    enum XML_Status (*xML_SetBase) (XML_Parser parser, const XML_Char *base); /* 12 */
    const XML_Char * (*xML_GetBase) (XML_Parser parser); /* 13 */
    int (*xML_GetSpecifiedAttributeCount) (XML_Parser parser); /* 14 */

Changes to generic/tdomStubLib.c.

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
const TdomStubs *tdomStubsPtr;

/*----------------------------------------------------------------------------
|   Tdom_InitStubs
|
\---------------------------------------------------------------------------*/

CONST char *
Tdom_InitStubs (
    Tcl_Interp *interp, 
    char *version, 
    int exact
    )
{
    CONST char *actualVersion;
    ClientData clientData = NULL;

#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION == 0)
    Tcl_SetResult(interp, "Too old Tcl version. Binary extensions "
                  "to tDOM are not possible, with a that outdated "
                  "Tcl version.", TCL_STATIC);
    return NULL;







|






|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
const TdomStubs *tdomStubsPtr;

/*----------------------------------------------------------------------------
|   Tdom_InitStubs
|
\---------------------------------------------------------------------------*/

const char *
Tdom_InitStubs (
    Tcl_Interp *interp, 
    char *version, 
    int exact
    )
{
    const char *actualVersion;
    ClientData clientData = NULL;

#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION == 0)
    Tcl_SetResult(interp, "Too old Tcl version. Binary extensions "
                  "to tDOM are not possible, with a that outdated "
                  "Tcl version.", TCL_STATIC);
    return NULL;

Changes to tests/all.tcl.

24
25
26
27
28
29
30





31
32
33
34
35
36
37
        ::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

puts stdout "Tcl $tcl_patchLevel tests running in interp:  [info nameofexecutable]"

if {$tcl_version < 8.2} {







>
>
>
>
>







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
        ::tcltest::testConstraint need_i18n 1
        if {[info procs ::tDOM::extRefHandler] != ""} {
            ::tcltest::testConstraint need_uri 1
        }
    }
}

::tcltest::testConstraint needExpand 1
if {$tcl_version < 8.5} {
    ::tcltest::testConstraint needExpand 0
}
    
set timeCmd {clock format [clock seconds]}

set ::tcltest::testSingleFile false

puts stdout "Tcl $tcl_patchLevel tests running in interp:  [info nameofexecutable]"

if {$tcl_version < 8.2} {

Changes to tests/domDoc.test.

1137
1138
1139
1140
1141
1142
1143




1144
1145
1146
1147
1148
1149


1150
1151
1152
1153
1154
1155
1156
    lappend result [[$doc documentElement] nodeName]
    $doc delete
    set result
} {<e1/> e1}

test domDoc-22.2 {appendFromScript} {
    set doc [dom parse <root/>]




    namespace eval nodeCmds {
        $doc appendFromScript {
            e1
            e2
        }
    }


    set result [$doc asXML -indent none]
    foreach node [$doc selectNodes *] {
        lappend result [$node parentNode]
        lappend result [expr {$doc == [$node ownerDocument]}]
    }
    $doc delete
    set result







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







1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151


1152
1153
1154
1155
1156
1157
1158
1159
1160
    lappend result [[$doc documentElement] nodeName]
    $doc delete
    set result
} {<e1/> e1}

test domDoc-22.2 {appendFromScript} {
    set doc [dom parse <root/>]
    $doc appendFromScript {
        nodeCmds::e1
        nodeCmds::e2
    }
    # namespace eval nodeCmds {
    #     $doc appendFromScript {
    #         e1
    #         e2


    #     }
    # }
    set result [$doc asXML -indent none]
    foreach node [$doc selectNodes *] {
        lappend result [$node parentNode]
        lappend result [expr {$doc == [$node ownerDocument]}]
    }
    $doc delete
    set result

Changes to tests/domjson.test.

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
    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







|







157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
    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} {needExpand} {
    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

Changes to tests/loadtdom.tcl.

9
10
11
12
13
14
15
16
17
18
19
20
package require tcltest
namespace import ::tcltest::*
if {[catch {package require -exact tdom 0.9.1}]} {
    if {[catch {load [file join [file dir [info script]] ../unix/libtdom0.9.1.so]}]} {
        error "Unable to load the appropriate tDOM version!"
    }
}
if {[info commands ::tDOM::xmlReadFile] eq ""} {
    # tcldomsh without the script library. Source the lib.
    source [file join [file dir [info script]] ../lib tdom.tcl]
}








|




9
10
11
12
13
14
15
16
17
18
19
20
package require tcltest
namespace import ::tcltest::*
if {[catch {package require -exact tdom 0.9.1}]} {
    if {[catch {load [file join [file dir [info script]] ../unix/libtdom0.9.1.so]}]} {
        error "Unable to load the appropriate tDOM version!"
    }
}
if {[info commands ::tDOM::xmlReadFile] == ""} {
    # tcldomsh without the script library. Source the lib.
    source [file join [file dir [info script]] ../lib tdom.tcl]
}