|
In a message dated 8/13/2004 4:50:17 PM Eastern Daylight Time,
[EMAIL PROTECTED] writes:
OK -- I updated the 4.1 code to support this. You can set a
"singlescript" ADP config option and the page is parsed into a single big script
block which supports the sequence above. It's off by
default. There's a new "safeeval" option which may be useful as
well. It's possible the code could be back ported to 4.0 or 3.x but I
didn't look into that.
BTW: It turns out the code to make this work, outside the various
config junk, wasn't to complicated. Basically it required calling a
function to collapse all the blocks together at the end of parsing -- the
key function is below.
Let me know if something is broken or weird.
-Jim
/*
*---------------------------------------------------------------------- * * Blocks2Script -- * * Collapse text/script blocks in a parse structure into a single * script. This enables a complete scripts to be made up of * multiple blocks, e.g., <% if $true { %> Text <% } %>. * * Results: * None. * * Side effects: * Parse structure is updated to a single script block. * *---------------------------------------------------------------------- */ static void
Blocks2Script(AdpParse *parsePtr) { char *utf, save; int i, len; Tcl_DString tmp, *textPtr; textPtr = &parsePtr->text;
Tcl_DStringInit(&tmp); Tcl_DStringAppend(&tmp, textPtr->string, textPtr->length); Tcl_DStringTrunc(textPtr, 0); utf = tmp.string; for (i = 0; i < parsePtr->code.nblocks; ++i) { len = parsePtr->code.len[i]; if (len < 0) { len = -len; Tcl_DStringAppend(textPtr, utf, len); } else { Tcl_DStringAppend(textPtr, "ns_adp_append", -1); save = utf[len]; utf[len] = '\0'; Tcl_DStringAppendElement(textPtr, utf); utf[len] = save; } Tcl_DStringAppend(textPtr, "\n", 1); utf += len; } parsePtr->code.nscripts = parsePtr->code.nblocks = 1; parsePtr->code.len[0] = -textPtr->length; parsePtr->code.base = textPtr->string; Tcl_DStringFree(&tmp); }
|
- Re: [AOLSERVER] AOLSERVER Digest - 10 Aug 2004 to 11... Dossy Shiobara
- Re: [AOLSERVER] AOLSERVER Digest - 10 Aug 2004 t... Brett Schwarz
- Re: [AOLSERVER] AOLSERVER Digest - 10 Aug 2004 t... Don Baccus
- Re: [AOLSERVER] AOLSERVER Digest - 10 Aug 20... Dossy Shiobara
- Re: [AOLSERVER] AOLSERVER Digest - 10 Au... Andrew Piskorski
- Re: [AOLSERVER] AOLSERVER Digest - ... Don Baccus
- Re: [AOLSERVER] AOLSERVER Digest - 10 Au... Steve
- Re: [AOLSERVER] AOLSERVER Digest - 10 Aug 2004 to 11 Aug ... Andrew Piskorski
- Re: [AOLSERVER] AOLSERVER Digest - 10 Aug 2004 to 11 Aug ... Andrew Piskorski
- Re: [AOLSERVER] AOLSERVER Digest - 10 Aug 2004 to 11 Aug ... Jim Davidson
- Re: [AOLSERVER] AOLSERVER Digest - 10 Aug 2004 to 11 Aug ... Jim Davidson
