tDOM

Check-in [c39b98ff18]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:Added stubs for new schemacmds methods "query" and "reportcmd".
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | schema
Files: files | file ages | folders
SHA3-256: c39b98ff184da5436a3e2e44b0e2598778d9dbe4c3defbc296e712256e4f54ff
User & Date: rolf 2019-02-21 00:49:41
Context
2019-02-22
01:35
Renamed schema obj cmd method query to info and worked at bit on that. Moved all code block defines to one place while adding one. check-in: 79df08c5d7 user: rolf tags: schema
2019-02-21
00:49
Added stubs for new schemacmds methods "query" and "reportcmd". check-in: c39b98ff18 user: rolf tags: schema
2019-02-19
01:33
Merged from trunk. check-in: 15ba66e204 user: rolf tags: schema
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/schema.c.

838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
....
1866
1867
1868
1869
1870
1871
1872





































1873
1874
1875
1876
1877
1878
1879
....
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898

1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
....
2257
2258
2259
2260
2261
2262
2263


















2264
2265
2266
2267
2268
2269
2270
                if (!mayskip && rc == -1) mayskip = 1;
                break;
            }

        }
                
        break;


        fprintf (stderr, "matchElementStart: SCHEMA_CTYPE_INTERLEAVE to be implemented\n");
        return 0;
    }
    return 0;
}

int
probeElement (
    Tcl_Interp *interp,
................................................................................
    sdata->cp = savedCP;
    sdata->contentSize = savedContenSize;
    if (sdata->cp && !sdata->isAttributeConstaint && cp->nc) {
        sdata->cp->flags |= CONSTRAINT_TEXT_CHILD;
    }
    return result;
}






































int
schemaInstanceCmd (
    ClientData clientData,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[]
................................................................................
    SchemaCP      *pattern, *current = NULL;
    void          *namespacePtr, *savedNamespacePtr;
    char          *xmlstr, *errMsg;
    domDocument   *doc;
    domNode       *node;

    static const char *schemaInstanceMethods[] = {
        "defelement", "defpattern",  "start", "event", "delete",
        "nrForwardDefinitions",      "state", "reset", "define",
        "validate",   "domvalidate", "deftext", NULL

    };
    enum schemaInstanceMethod {
        m_defelement,  m_defpattern,  m_start, m_event, m_delete,
        m_nrForwardDefinitions,       m_state, m_reset, m_define,
        m_validate,    m_domvalidate, m_deftext
    };

    static const char *eventKeywords[] = {
        "start", "end", "text", NULL
    };

    enum eventKeyword
................................................................................
                Tcl_SetVar (interp, Tcl_GetString (objv[3]),
                            Tcl_GetStringResult (interp), 0);
            }
            SetBooleanResult (0);
        }
        schemaReset (sdata);
        break;



















    default:
        Tcl_SetResult (interp, "unknown method", NULL);
        result = TCL_ERROR;
        break;

    }






<
<
<
<







 







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







 







|
|
|
>


|
|
|







 







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







838
839
840
841
842
843
844




845
846
847
848
849
850
851
....
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
....
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
....
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
                if (!mayskip && rc == -1) mayskip = 1;
                break;
            }

        }
                
        break;




    }
    return 0;
}

int
probeElement (
    Tcl_Interp *interp,
................................................................................
    sdata->cp = savedCP;
    sdata->contentSize = savedContenSize;
    if (sdata->cp && !sdata->isAttributeConstaint && cp->nc) {
        sdata->cp->flags |= CONSTRAINT_TEXT_CHILD;
    }
    return result;
}

static int
schemaInstanceQueryCmd (
    SchemaData *sdata,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[]
    )
{
    int methodIndex;
    
    static const char *schemaInstanceQueryMethods[] = {
        "defelements", NULL
    };
    enum schemaInstanceQueryMethod {
        m_defelements
    };

    if (objc < 2) {
        Tcl_WrongNumArgs (interp, 1, objv, "subcommand ?arguments?");
        return TCL_ERROR;
    }

    if (Tcl_GetIndexFromObj (interp, objv[1], schemaInstanceQueryMethods,
                             "method", 0, &methodIndex)
        != TCL_OK) {
        return TCL_ERROR;
    }
    
    Tcl_ResetResult (interp);
    switch ((enum schemaInstanceQueryMethod) methodIndex) {
    case m_defelements:
        break;
    }
    
    return TCL_OK;
}

int
schemaInstanceCmd (
    ClientData clientData,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[]
................................................................................
    SchemaCP      *pattern, *current = NULL;
    void          *namespacePtr, *savedNamespacePtr;
    char          *xmlstr, *errMsg;
    domDocument   *doc;
    domNode       *node;

    static const char *schemaInstanceMethods[] = {
        "defelement", "defpattern",  "start",   "event", "delete",
        "nrForwardDefinitions",      "state",   "reset", "define",
        "validate",   "domvalidate", "deftext", "query", "reportcmd",
        NULL
    };
    enum schemaInstanceMethod {
        m_defelement,  m_defpattern,  m_start,   m_event, m_delete,
        m_nrForwardDefinitions,       m_state,   m_reset, m_define,
        m_validate,    m_domvalidate, m_deftext, m_query, m_reportcmd
    };

    static const char *eventKeywords[] = {
        "start", "end", "text", NULL
    };

    enum eventKeyword
................................................................................
                Tcl_SetVar (interp, Tcl_GetString (objv[3]),
                            Tcl_GetStringResult (interp), 0);
            }
            SetBooleanResult (0);
        }
        schemaReset (sdata);
        break;

    case m_query:
        objv++;
        objc++;
        result = schemaInstanceQueryCmd (sdata, interp, objc, objv);
        break;

    case m_reportcmd:
        if (objc != 3) {
            Tcl_WrongNumArgs (interp, 2, objv, "<tcl-cmd>");
            return TCL_ERROR;
        }
        if (sdata->reportCmd) {
            Tcl_DecrRefCount (sdata->reportCmd);
        }
        sdata->reportCmd = objv[2];
        Tcl_IncrRefCount (sdata->reportCmd);
        break;

    default:
        Tcl_SetResult (interp, "unknown method", NULL);
        result = TCL_ERROR;
        break;

    }

Changes to generic/schema.h.

116
117
118
119
120
121
122

123
124
125
126
127
128
129
    SchemaCP **patternList; 
    unsigned int numPatternList;
    unsigned int patternListSize;
    unsigned int forwardPatternDefs;
    SchemaQuant *quants;
    unsigned int numQuants;
    unsigned int quantsSize;

    Tcl_Obj **evalStub;
    Tcl_Obj **textStub;
    char *currentNamespace;
    int   defineToplevel;
    int   isTextConstraint;
    int   isAttributeConstaint;
    SchemaCP *cp;






>







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
    SchemaCP **patternList; 
    unsigned int numPatternList;
    unsigned int patternListSize;
    unsigned int forwardPatternDefs;
    SchemaQuant *quants;
    unsigned int numQuants;
    unsigned int quantsSize;
    Tcl_Obj *reportCmd;
    Tcl_Obj **evalStub;
    Tcl_Obj **textStub;
    char *currentNamespace;
    int   defineToplevel;
    int   isTextConstraint;
    int   isAttributeConstaint;
    SchemaCP *cp;