Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fasten work. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | schema |
Files: | files | file ages | folders |
SHA3-256: |
121b7f42adb5e92fee043af8774afd29 |
User & Date: | rolf 2020-02-04 01:11:13.760 |
Context
2020-02-06
| ||
23:41 | Code fix. check-in: 106ae257a7 user: rolf tags: schema | |
2020-02-04
| ||
01:11 | Fasten work. check-in: 121b7f42ad user: rolf tags: schema | |
2020-02-01
| ||
01:22 | Added an optimization in case of serveral easily distinguished choices in a choice content particle. check-in: 19b4a5d0ea user: rolf tags: schema | |
Changes
Changes to generic/schema.c.
︙ | ︙ | |||
530 531 532 533 534 535 536 | if (pattern->attrs) { for (i = 0; i < pattern->numAttr; i++) { FREE (pattern->attrs[i]); } FREE (pattern->attrs); } freedomKeyConstraints (pattern->domKeys); | | | | | 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | if (pattern->attrs) { for (i = 0; i < pattern->numAttr; i++) { FREE (pattern->attrs[i]); } FREE (pattern->attrs); } freedomKeyConstraints (pattern->domKeys); if (pattern->typedata) { Tcl_DeleteHashTable ((Tcl_HashTable *) pattern->typedata); FREE (pattern->typedata); } break; } if (pattern->defScript) { Tcl_DecrRefCount (pattern->defScript); } if (pattern->associated) { |
︙ | ︙ | |||
1230 1231 1232 1233 1234 1235 1236 | pushToStack (sdata, candidate); updateStack (se, cp, ac); return 1; } break; case SCHEMA_CTYPE_CHOICE: | | | > | 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 | pushToStack (sdata, candidate); updateStack (se, cp, ac); return 1; } break; case SCHEMA_CTYPE_CHOICE: if (candidate->typedata) { h = Tcl_FindHashEntry ((Tcl_HashTable *)candidate->typedata, name); if (h) { icp = Tcl_GetHashValue (h); if (icp->namespace == namespace) { pushToStack (sdata, icp); updateStack (se, cp, ac); return 1; } |
︙ | ︙ | |||
4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 | { SchemaCP *savedCP; SchemaAttr **savedCurrentAttrs; unsigned int savedContenSize; unsigned int savedAttrSize, savedNumAttr, savedNumReqAttr; int result, i, onlyName, hnew; Tcl_HashEntry *h; /* Save some state of sdata .. */ savedCP = sdata->cp; savedContenSize = sdata->contentSize; savedNumAttr = sdata->numAttr; savedNumReqAttr = sdata->numReqAttr; savedAttrSize = sdata->attrSize; | > | 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 | { SchemaCP *savedCP; SchemaAttr **savedCurrentAttrs; unsigned int savedContenSize; unsigned int savedAttrSize, savedNumAttr, savedNumReqAttr; int result, i, onlyName, hnew; Tcl_HashEntry *h; Tcl_HashTable *t; /* Save some state of sdata .. */ savedCP = sdata->cp; savedContenSize = sdata->contentSize; savedNumAttr = sdata->numAttr; savedNumReqAttr = sdata->numReqAttr; savedAttrSize = sdata->attrSize; |
︙ | ︙ | |||
4875 4876 4877 4878 4879 4880 4881 | break; } } } if (pattern->type == SCHEMA_CTYPE_CHOICE && onlyName && pattern->nc > sdata->choiceHashThreshold) { | | | | < | | < > | 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 | break; } } } if (pattern->type == SCHEMA_CTYPE_CHOICE && onlyName && pattern->nc > sdata->choiceHashThreshold) { t = TMALLOC (Tcl_HashTable); Tcl_InitHashTable (t, TCL_ONE_WORD_KEYS); hnew = 1; for (i = 0; i < pattern->nc; i++) { if (pattern->content[i]->type != SCHEMA_CTYPE_NAME) { continue; } h = Tcl_CreateHashEntry (t, pattern->content[i]->name, &hnew); if (!hnew) { break; } Tcl_SetHashValue (h, pattern->content[i]); } if (!hnew) { /* No simple lookup possible because of more than one * elements with the same local name belong to the * choices. Rewind. */ Tcl_DeleteHashTable (t); FREE (t); } pattern->typedata = (void *)t; } addToContent (sdata, pattern, quant, n, m); } else { freeSchemaCP (pattern); } return result; } |
︙ | ︙ |
Changes to generic/schema.h.
︙ | ︙ | |||
102 103 104 105 106 107 108 | char *name; char *typeName; struct SchemaCP *next; SchemaFlags flags; struct SchemaCP **content; SchemaQuant *quants; unsigned int nc; | | | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | char *name; char *typeName; struct SchemaCP *next; SchemaFlags flags; struct SchemaCP **content; SchemaQuant *quants; unsigned int nc; void *typedata; SchemaAttr **attrs; unsigned int numAttr; unsigned int numReqAttr; domKeyConstraint *domKeys; SchemaKeySpace *keySpace; Tcl_Obj *defScript; Tcl_Obj *associated; |
︙ | ︙ |
Changes to tests/schema.test.
︙ | ︙ | |||
2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 | {<doc><e1/><e3/><e4/></doc>} } { lappend result [grammar validate $xml] } grammar delete set result } {0 1 1 1 1 1 1} test schema-10.1 {any} { tdom::schema create s s define { defelement doc { element a any | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 | {<doc><e1/><e3/><e4/></doc>} } { lappend result [grammar validate $xml] } grammar delete set result } {0 1 1 1 1 1 1} test schema-9.10 {choice with may choices} { tdom::schema create grammar grammar define { defelement doc { element e1 choice * { for {set i 1} {$i <= 20} {incr i} { element ee$i } } element e2 ? } } set result [list] foreach xml { <doc/> {<doc><e1/></doc>} {<doc><e1/><e2/></doc>} {<doc><e1/><ee3/></doc>} {<doc><e1/><ee4/></doc>} {<doc><e1/><e2/><ee4/></doc>} {<doc><e1/><ee2/><e2/></doc>} } { lappend result [grammar validate $xml] } grammar delete set result } {0 1 1 1 1 0 1} test schema-10.1 {any} { tdom::schema create s s define { defelement doc { element a any |
︙ | ︙ |