Hi Amos,
With respect to ESI and whatever little that I have understood after
looking at the code it seems that the user defined variables are not
evaluated when used in WHEN statement . In the file ESIAssign.cc file
, I added "process(0)" which calls the process function . The
process function is in the ESIAssign.cc . Really don't know whether
this is the correct way , but doing so does substitute the variables
in the "WHEN" statement with their real values . Also the problem
seems to be that if one uses "assign" statement in a WHEN statement as
shown below , irrespective of whether the WHEN test is true or false
the assign statements are executed. Is it a parser issue?
Can anybody help regarding this ?
<esi:assign name="number" value="100"/>
<esi:choose>
<esi:when test="$(number)<=6">
I am in "First" When statement.....
<br> number = $(number)
<esi:assign name="test" value="1234"/>
<br> test = $(test)
</esi:when>
<esi:when test="$(number)==8">
I am in "Second" When statement...
<br> number = $(number)
</esi:when>
<esi:when test="$(number)==100">
I am in "Third" When statement .....
</esi:when>
<esi:otherwise>
<br> I am in ESI "otherwise" statement..
</esi:otherwise>
</esi:choose>
***********************************************************************************************************
ESIAssign::ESIAssign (esiTreeParentPtr aParent, int attrcount, char
const **attr, ESIContext *aContext ) : parent (aParent), varState
(NULL), name(), value (NULL), variable (NULL), unevaluatedVariable()
{
/* TODO: grab content IFF no value was specified */
assert (aContext);
varState = cbdataReference(aContext->varState);
for (int i = 0; i < attrcount && attr[i]; i += 2) {
if (!strcmp(attr[i],"name")) {
/* the variables name is ... */
debugs(86, 5, "ESIAssign::ESIAssign: Variable name '" <<
attr[i+1] << "'");
/* If there are duplicate name attributes, we simply use the
* last one
*/
name = attr[i+1];
} else if (!strcmp(attr[i],"value")) {
/* short form assignment: */
debugs(86, 5, "ESIAssign::ESIAssign: Unevaluated variable
'" << attr[i+1] << "'");
/* Again, if there are duplicate attributes, we use the last */
unevaluatedVariable = attr[i+1];
process(0);
} else {
/* ignore mistyped attributes. TODO:? error on these for
user feedback - config parameter needed
*/
}
}
//varState = cbdataReference(aContext->varState);
}
*******************************************************************************************************************
Thank you.
-Paras
On Thu, Apr 17, 2008 at 7:27 PM, Amos Jeffries <squid3@treenet.co.nz> wrote:
> Paras Fadte wrote:
>
> > Hi,
> >
> >
> > I tried "Stack<char> test" and used test.push_back() method instead
> > of test.push() which is what standard STL stack provides I guess and
> > it seems to work. Alex, may be I should have said "When I try to
> > declare a stack of type char/int/string" .
> >
> > Also can I get any help regarding development of ESI in squid ?
> >
>
> I'm willing to throw my 2c in but I have no prior ESI knowledge. All I can
> help with is the C/C++ design and logic flows, maybe some testing.
>
> Regarding the char/strings stuff. What I have seen of the old code it tries
> to use the Squid 'String' type over general char* strings. That was
> apparently the cause of several bugs. String has since been tested better
> and fixed a fair bit, so it should be okay, and any new bugs found will be a
> net positive.
>
> Amos
>
>
>
>
> >
> > Thanks Amos,Alex.
> >
> > -Paras
> >
> >
> > On Wed, Apr 16, 2008 at 9:08 PM, Alex Rousskov
> > <rousskov@measurement-factory.com> wrote:
> >
> > > On Wed, 2008-04-16 at 13:37 +1200, Amos Jeffries wrote:
> > > > >
> > > > > Thanks for the reply. The header file that I want to include is
> > > > > "stack" which is already available in C++ just like "iostream" .
> When
> > > > > I include it in a squid source file and try to create a stack
> > > > > datatype, it gives an error saying "error: `stack' undeclared
> (first
> > > > > use this function) " .
> > > >
> > > > Ah. That is an entirely different issue to what you described in your
> > > > first mail. There are now a couple of issues here to consider.
> > > >
> > > > 1) why you are needing to add it to squid.
> > > > 2) why you are trying to re-invent a type that is already well-known
> and
> > > > available for use in probably all OS.
> > > > 3) how to protect your new code against other types.
> > > >
> > > > A good think about 1 and 2 usually comes up with its not worth the
> work,
> > > > just use the STL version provided.
> > >
> > > I believe Paras is trying to use the existing STL stack type even
> though
> > > he is saying that he is trying to "create a stack datatype" :-).
> > >
> > > Cheers,
> > >
> > > Alex.
> > >
> > >
> > >
> > > > I'm not familiar with the specific guidelines in squid-2 (they are in
> the
> > > > wiki somewhere IIRC). But for squid-3 when we need to add a standard
> type
> > > > like this locally we name it like 'SquidStack' and the files the
> same.
> > > > That way there is no clash to worry about.
> > > >
> > > > Also there is basic code-wrapping. Any new experimental code needs to
> have
> > > > a configure option to enable it, with a matching macro USE_... which
> is
> > > > used to protect normal builds against the new code.
> > > >
> > > > If you are going to insist on using a clashing type, you will force
> > > > yourself to go through the OS provided <stack> and dependencies and
> > > > un-define all the symbols that might cause problems. Its a big
> problem,
> > > > and _really_ not worth it.
> > > >
> > > > >
> > > > >
> > > > > Example:
> > > > >
> > > > > #include <stack>
> > > >
> > > > <> in C/C++ means the compiler is specifically asked to find an OS
> > > > provided file before testing the local ones. Not your new one.
> > > > You MUST have double-quotes (") for local files. And preferably a
> unique
> > > > localised name as I mention above.
> > > >
> > > > >
> > > > > stack<char> test; - -> gives error.
> > > > >
> > > > > Thank you.
> > > > >
> > > > > -Plf
> > > > >
> > > > > On 4/15/08, Amos Jeffries <squid3@treenet.co.nz> wrote:
> > > > >> Paras Fadte wrote:
> > > > >>
> > > > >> > Hi,
> > > > >> >
> > > > >> > I was trying to add header file "stack.h" in one of the squids
> source
> > > > >> > code file so that I could define stack data types. But it
> doesn't
> > > > >> > seem to work . Can anybody help me out with this please?
> > > > >> >
> > > > >> >
> > > > >>
> > > > >> Code discussions in squid-dev please.
> > > > >>
> > > > >> You need to:
> > > > >> - add the files to the right sub-directory in the source,
> > > > >> - add to teh matching Makefile.am in all the right places,
> > > > >> - run bootstrap.sh,
> > > > >> - run configure,
> > > > >> - run make check,
> > > > >> - ... and fix any of the errors that come up about your files.
> > > > >> - test it works, and then submit a patch and request to have it
> used.
> > > > >>
> > > > >> NP: other errors in existing code. If any occur, please mention
> to
> > > > >> squid-dev so we can check and fix.
> > > > >>
> > > > >> Amos
> > > > >> --
> > > > >> Please use Squid 2.6.STABLE19 or 3.0.STABLE4
> > > > >>
> > > > >
> > > >
> > >
> > >
> > >
> >
>
>
> --
>
> Please use Squid 2.6.STABLE19 or 3.0.STABLE4
>
Received on Wed Apr 23 2008 - 11:55:33 MDT
This archive was generated by hypermail 2.2.0 : Wed Apr 30 2008 - 12:00:07 MDT