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

Overview
Comment:wip
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wip
Files: files | file ages | folders
SHA3-256: 1f46cc97c2812ee277c7f4c7ff06836913d7672ed2c6bd32563db0e91f2ee2d4
User & Date: rolf 2019-10-01 23:10:55
Context
2019-10-03
02:18
This returns even something to script level. check-in: c8b0062672 user: rolf tags: wip
2019-10-01
23:10
wip check-in: 1f46cc97c2 user: rolf tags: wip
2019-09-27
00:37
Renamed info defelements into definedElements and factored the implementation out for use in info expected. check-in: ec0ddc4465 user: rolf tags: wip
Changes

Changes to generic/schema.c.

2753
2754
2755
2756
2757
2758
2759
2760

















































































































2761
2762
2763
2764
2765
2766
2767
....
2768
2769
2770
2771
2772
2773
2774

2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
....
2863
2864
2865
2866
2867
2868
2869

2870
2871
2872
2873
2874
2875
2876
2877
2878
....
2879
2880
2881
2882
2883
2884
2885


2886



2887
2888
2889
2890
2891
2892
2893
        if (!cp) continue;
        if (cp->flags & FORWARD_PATTERN_DEF
            || cp->flags & PLACEHOLDER_PATTERN_DEF) continue;
        elmObj = serializeElementName (interp, cp);
        Tcl_ListObjAppendElement (interp, rObj, elmObj);
    }
}
    

















































































































static int
schemaInstanceInfoCmd (
    SchemaData *sdata,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[]
    )
................................................................................
{
    int methodIndex;
    Tcl_HashEntry *h;
    SchemaCP *cp;
    SchemaValidationStack *se;
    Tcl_Obj *elmObj;
    void *ns;

    
    static const char *schemaInstanceInfoMethods[] = {
        "validationstate", "vstate", "definedElements", "stack", "toplevel",
        "expected", "definition", NULL
    };
    enum schemaInstanceInfoMethod {
        m_validationstate, m_vstate, m_definedElements, m_stack, m_toplevel,
        m_expected, m_definition
    };

    static const char *schemaInstanceInfoStackMethods[] = {
        "top", "inside", NULL
    };
    enum schemaInstanceInfoStackMethod {
        m_top, m_inside
................................................................................
            return TCL_ERROR;
        }
        if (!sdata->defineToplevel && sdata->currentEvals > 1) {
            SetBooleanResult (0);
        } else {
            SetBooleanResult (1);
        }


    case m_expected:
        if (sdata->validationState != VALIDATION_STARTED) {
            SetResult ("No validation started");
            return TCL_ERROR;
        }
        if (!sdata->stack) {
            if (sdata->start) {
                Tcl_AppendElement (interp, sdata->start);
................................................................................
                if (sdata->startNamespace) {
                    Tcl_AppendElement (interp, sdata->startNamespace);
                }
            } else {
                definedElements (sdata, interp);
            }
        } else {


        }



        break;
        
    case m_definition:
        if (objc < 3 && objc > 4) {
            Tcl_WrongNumArgs (interp, 1, objv, "name ?namespace?");
            return TCL_ERROR;
        }







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







 







>



|



|







 







>

|







 







>
>

>
>
>







2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
....
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
....
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
....
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
        if (!cp) continue;
        if (cp->flags & FORWARD_PATTERN_DEF
            || cp->flags & PLACEHOLDER_PATTERN_DEF) continue;
        elmObj = serializeElementName (interp, cp);
        Tcl_ListObjAppendElement (interp, rObj, elmObj);
    }
}

static void
getFrontExpected (
    SchemaValidationStack *se,
    Tcl_Interp *interp,
    Tcl_Obj *rObj
    )
{
    int ac, hm, i;
    SchemaCP *cp, *ic, *jc;

    getContext (cp, ac, hm);
    if (hasMatched(cp->quants[ac], hm)) {
        ac++;
        hm = 0;
    }
    switch (cp->type) {
    case SCHEMA_CTYPE_INTERLEAVE:
        if (se->interleaveState) {
            for (i = 0; i < cp->nc; i++) {
                if (se->interleaveState[i] && maxOne (cp->quants[i])) {
                    continue;
                }
                
            }
            
            
            break;
        }
        /* Fall through */
    case SCHEMA_CTYPE_NAME:
    case SCHEMA_CTYPE_PATTERN:
        while (ac < cp->nc) {
            ic = cp->content[ac];
            switch (ic->type) {
            case SCHEMA_CTYPE_NAME:
                Tcl_ListObjAppendElement (interp, rObj,
                                          serializeElementName (interp, ic));
                break;
            case SCHEMA_CTYPE_INTERLEAVE:
            case SCHEMA_CTYPE_PATTERN:
                /* Mumble mumble */
                break;

            case SCHEMA_CTYPE_ANY:
                Tcl_ListObjAppendElement (interp, rObj,
                                          Tcl_NewStringObj ("<any>", 5));
                break;

            case SCHEMA_CTYPE_TEXT:
                Tcl_ListObjAppendElement (interp, rObj,
                                          Tcl_NewStringObj ("#text", 5));
                break;
                
            case SCHEMA_CTYPE_CHOICE:
                for (i = 0; i < ic->nc; i++) {
                    jc = ic->content[i];
                    switch (jc->type) {
                    case SCHEMA_CTYPE_NAME:
                        Tcl_ListObjAppendElement (
                            interp, rObj, serializeElementName (interp, jc)
                            );
                        break;
                    case SCHEMA_CTYPE_INTERLEAVE:
                    case SCHEMA_CTYPE_PATTERN:
                        /* Mumble mumble */
                        break;

                    case SCHEMA_CTYPE_ANY:
                        Tcl_ListObjAppendElement (
                            interp, rObj, Tcl_NewStringObj ("<any>", 5)
                            );
                        break;

                    case SCHEMA_CTYPE_TEXT:
                        Tcl_ListObjAppendElement (
                            interp, rObj, Tcl_NewStringObj ("#text", 5)
                            );
                        break;
                    case SCHEMA_CTYPE_CHOICE:
                        Tcl_Panic ("MIXED or CHOICE child of MIXED or CHOICE");

                    case SCHEMA_CTYPE_VIRTUAL:
                    case SCHEMA_CTYPE_KEYSPACE:
                    case SCHEMA_CTYPE_KEYSPACE_END:
                        break;
                    }
                }
                break;

            case SCHEMA_CTYPE_VIRTUAL:
            case SCHEMA_CTYPE_KEYSPACE:
            case SCHEMA_CTYPE_KEYSPACE_END:
                break;
            }
                    
        }
        break;
        
        
    case SCHEMA_CTYPE_ANY:
    case SCHEMA_CTYPE_CHOICE:
    case SCHEMA_CTYPE_TEXT:
    case SCHEMA_CTYPE_VIRTUAL:
    case SCHEMA_CTYPE_KEYSPACE:
    case SCHEMA_CTYPE_KEYSPACE_END:
        Tcl_Panic ("Invalid CTYPE onto the validation stack!");
    }
    if (cp->type == SCHEMA_CTYPE_NAME) {
        return;
    }
    
}

static int
schemaInstanceInfoCmd (
    SchemaData *sdata,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[]
    )
................................................................................
{
    int methodIndex;
    Tcl_HashEntry *h;
    SchemaCP *cp;
    SchemaValidationStack *se;
    Tcl_Obj *elmObj;
    void *ns;
    Tcl_Obj *rObj;
    
    static const char *schemaInstanceInfoMethods[] = {
        "validationstate", "vstate", "definedElements", "stack", "toplevel",
        "pastexpected", "frontexpected", "definition", NULL
    };
    enum schemaInstanceInfoMethod {
        m_validationstate, m_vstate, m_definedElements, m_stack, m_toplevel,
        m_pastexpected, m_frontexpected, m_definition
    };

    static const char *schemaInstanceInfoStackMethods[] = {
        "top", "inside", NULL
    };
    enum schemaInstanceInfoStackMethod {
        m_top, m_inside
................................................................................
            return TCL_ERROR;
        }
        if (!sdata->defineToplevel && sdata->currentEvals > 1) {
            SetBooleanResult (0);
        } else {
            SetBooleanResult (1);
        }
        return TCL_OK;

    case m_frontexpected:
        if (sdata->validationState != VALIDATION_STARTED) {
            SetResult ("No validation started");
            return TCL_ERROR;
        }
        if (!sdata->stack) {
            if (sdata->start) {
                Tcl_AppendElement (interp, sdata->start);
................................................................................
                if (sdata->startNamespace) {
                    Tcl_AppendElement (interp, sdata->startNamespace);
                }
            } else {
                definedElements (sdata, interp);
            }
        } else {
            rObj = Tcl_GetObjResult (interp);
            getFrontExpected (sdata->stack, interp, rObj);
        }
        return TCL_OK;
        
    case m_pastexpected:
        break;
        
    case m_definition:
        if (objc < 3 && objc > 4) {
            Tcl_WrongNumArgs (interp, 1, objv, "name ?namespace?");
            return TCL_ERROR;
        }