--------------------- PatchSet 106 Date: 2002/11/01 08:55:54 Author: rbcollins Branch: esi Tag: (none) Log: removing process macro Members: src/ESI.cc:1.1.2.15->1.1.2.16 Index: squid3/src/ESI.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESI.cc,v retrieving revision 1.1.2.15 retrieving revision 1.1.2.16 diff -u -r1.1.2.15 -r1.1.2.16 --- squid3/src/ESI.cc 1 Nov 2002 08:29:15 -0000 1.1.2.15 +++ squid3/src/ESI.cc 1 Nov 2002 08:55:54 -0000 1.1.2.16 @@ -1,6 +1,6 @@ /* - * $Id: ESI.cc,v 1.1.2.15 2002/11/01 08:29:15 rbcollins Exp $ + * $Id: ESI.cc,v 1.1.2.16 2002/11/01 08:55:54 rbcollins Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -62,7 +62,7 @@ typedef struct _esiStreamContext esiStreamContext; typedef struct _esiContext esiContext; -/* TODO: split thisNode out into separate files ? */ +/* TODO: split this out into separate files ? */ /* Parsing: quick and dirty. ESI files are not valid XML, so a generic * XML parser is not much use. Also we need a push parser not a pull * parser, so LibXML is out. @@ -158,13 +158,9 @@ ESI_KICK_SENT } esiKick_t; -typedef struct _esiElementType esiElementType; - -class esiElement; - -typedef esiProcessResult_t esiProcessSelf (void *, int); /* process thisNode element */ +typedef esiProcessResult_t esiProcessSelf (void *, int); /* process this element */ #define PROCESS(foo, bar) foo->Vptr->process(foo, bar) -struct _esiElementType { +struct esiElementType { esiProcessSelf *process; }; struct esiElement { @@ -174,14 +170,24 @@ return false; } virtual void render (esiSegment *) = 0; + /* process this element */ + virtual esiProcessResult_t process (int dovars) { + debug (86,5) ("esiProcessComplete: Processed %p\n",this); + return ESI_PROCESS_COMPLETE; + } virtual void deleteSelf() = 0; + esiElementType *Vptr; }; /* some core operators */ /* the methods for each type */ -static esiProcessSelf esiProcessComplete; +esiProcessResult_t processThunk(void *data, int dovars) +{ + return ((esiElement *)data)->process(dovars); +} + static esiProcessSelf esiLiteralProcess; static esiProcessSelf esiSequenceProcess; @@ -209,11 +215,11 @@ ESI_ELEMENT_OTHERWISE } esiElementType_t; -static esiElementType _esiComment = {esiProcessComplete}; +static esiElementType _esiComment = {processThunk}; static esiElementType _esiLiteral = {esiLiteralProcess}; static esiElementType _esiSequence = {esiSequenceProcess}; static esiElementType _esiInclude = {esiIncludeProcess}; -static esiElementType _esiRemove = {esiProcessComplete}; +static esiElementType _esiRemove = {processThunk}; static esiElementType _esiTry = {esiTryProcess}; /* esiAttempt, esiExcept, esiVar, esiWhen and esiOtherwise are 'Sequences' */ static esiElementType _esiAttempt = {esiSequenceProcess}; @@ -385,7 +391,7 @@ /* esiContext */ struct _esiContext { clientStreamNode *thisNode; /* our stream node */ - clientHttpRequest *http; /* the request we are processing. HMM: cbdataReferencing thisNode will result + clientHttpRequest *http; /* the request we are processing. HMM: cbdataReferencing this will result in a circular reference, so we don't. Note: we are automatically freed when it is, so thats ok. */ struct { int passthrough:1; @@ -422,7 +428,7 @@ esiElement *stack[10]; /* a stack of esi elements that are open */ int stackdepth; /* self explanatory */ XML_Parser p; /* our parser */ - } parserState; /* todo factor thisNode off somewhere else; */ + } parserState; /* todo factor this off somewhere else; */ esiVarState *varState; esiElement *tree; }; @@ -492,7 +498,7 @@ debug (86,5)("esiKick: esiProcess PENDING UNKNOWN\n");break; case ESI_PROCESS_FAILED: debug (86,0)("esiKick: esiProcess %p FAILED\n", context); - /* thisNode can not happen - processing can't fail until we have data, + /* this can not happen - processing can't fail until we have data, * and when we come here we have sent data to the client */ if (context->pos == 0) @@ -1662,16 +1668,6 @@ /* Implementation of esiElements */ -/* 'inherited' methods */ - - -/* always complete processing */ -esiProcessResult_t -esiProcessComplete (void *data, int dovars) { - debug (86,5) ("esiProcessComplete: Processed %p\n",data); - return ESI_PROCESS_COMPLETE; -} - /* esiComment */ void esiCommentFree (void *data)