rem: Tag            *tagPtr; char           *ss, *se, *s, *e, *a, *as, *ae, *t; int             level, state, stream, streamdone;
add: Tag            *tagPtr = NULL; char           *ss = NULL, *se = NULL, *s = NULL, *e = NULL; char           *a = NULL, *as = NULL, *ae = NULL , *t = NULL; int             level = 0, state, stream, streamdone;
context: Parse(AdpParse *parsePtr, NsServer *servPtr, char *utf){    Tag            *tagPtr;    char           *ss, *se, *s, *e, *a, *as, *ae, *t;    int             level, state, stream, streamdone;    Tcl_DString     tag;    Tcl_HashEntry  *hPtr;    Tcl_DStringInit(&tag);    t = utf;    streamdone = 0;    state = 0;    Ns_RWLockRdLock(&servPtr->adp.taglock);    while ((s = strchr(utf, '<')) && (e = strchr(s, '>'))) {	/*	 * Process the tag depending on the current state.	 */	switch (state) {	case 0:	    /*	     * Look for possible <script> or <tag>.	     */	    GetTag(&tag, s, e, &a);	    if (IsServer(tag.string, a, e, &stream)) {		/*		 * Record start of script.		 */		ss = s;		se = e + 1;		state = 1;	    } else {    		hPtr = Tcl_FindHashEntry(&servPtr->adp.tags, tag.string);    		if (hPtr != NULL) {		    tagPtr = Tcl_GetHashValue(hPtr);		    if (tagPtr->endtag == NULL) {			/*			 * Output simple no-end registered tag.			 */			AppendBlock(parsePtr, t, s, 't');			t = e + 1;			AppendTag(parsePtr, tagPtr, a, e, NULL);		    } else {			/*			 * Record start of registered tag.			 */			ss = s;			as = a;			ae = e;			level = 1;			state = 2;		    }		}	    }	    break;	case 1:	    GetTag(&tag, s, e, NULL);	    if (STREQ(tag.string, "/script")) {		/*		 * Output end of script.		 */		AppendBlock(parsePtr, t, ss, 't');		t = e + 1;		if (stream && !streamdone) {		    AppendBlock(parsePtr, "ns_adp_stream", NULL, 's');		    streamdone = 1;		}		AppendBlock(parsePtr, se, s, 's');		state = 0;	    }	    break;	case 2:	    GetTag(&tag, s, e, NULL);	    if (STRIEQ(tag.string, tagPtr->tag)) {		/*		 * Increment register tag nesting level.		 */		++level;	    } else if (STRIEQ(tag.string, tagPtr->endtag)) {		--level;		if (level == 0) {		    /*		     * Dump out registered tag.		     */		    AppendBlock(parsePtr, t, ss, 't');		    t = e + 1;		    AppendTag(parsePtr, tagPtr, as, ae, s);		    state = 0;		}	    }	    break;	}	utf = s + 1;    }    Ns_RWLockUnlock(&servPtr->adp.taglock);    /*     * Append the remaining text block.     */    AppendBlock(parsePtr, t, t + strlen(t), 't');    Tcl_DStringFree(&tag);}