>Fr Jan 16 2009 04:43:59 EST von m...@comalies (comalies) 
>
>  
>
>I'm going through the changes right now, but I've run into a problem with
>another iterator (LKRA):
>
>gdb) frame 0
>#0  0x0002a008 in CheckContext (Target=0x25d320, Need=0x2164a0,
>TP=0xb0281294, ErrType=0x679a6 "Conditional") at subst.c:204
>204                    LogTemplateError(
>(gdb) bt
>#0  0x0002a008 in CheckContext (Target=0x25d320, Need=0x2164a0,
>TP=0xb0281294, ErrType=0x679a6 "Conditional") at subst.c:204
>#1  0x0002d4fe in EvaluateConditional (Target=0x25d320, Neg=1, state=0,
>TP=0xb0281294) at subst.c:1752
>#2  0x0002c754 in EvaluateToken (Target=0x25d320, state=0, TP=0xb0281294) at
>subst.c:1386
>#3  0x0002cb82 in ProcessTemplate (Tmpl=0x231fb0, Target=0x25d320,
>Context=0x25eb70, ContextType=15) at subst.c:1489
>#4  0x0002ce54 in DoTemplate (templatename=0xc11a17 "json_floor", len=10,
>Target=0x25d320, TP=0xb028137c) at subst.c:1558
>#5  0x0002d280 in tmpl_iterate_subtmpl (Target=0x25c950, TP=0xb0281444) at
>subst.c:1681
>#6  0x0002c91a in EvaluateToken (Target=0x25c950, state=0, TP=0xb0281444) at
>subst.c:1423
>#7  0x0002cb82 in ProcessTemplate (Tmpl=0x2323f0, Target=0x25c950,
>Context=0x0, ContextType=0) at subst.c:1489
>#8  0x0002ce54 in DoTemplate (templatename=0xc23a12 "json_floors", len=11,
>Target=0x25c950, TP=0xb0281554) at subst.c:1558
>#9  0x0002c8c1 in EvaluateToken (Target=0x25c950, state=0, TP=0xb0281554) at
>subst.c:1416
>#10 0x0002cb82 in ProcessTemplate (Tmpl=0x232e80, Target=0x25c950,
>Context=0x0, ContextType=0) at subst.c:1489
>#11 0x0002ce54 in DoTemplate (templatename=0x64688 "json_roomflr", len=12,
>Target=0x25c950, TP=0xf9c40) at subst.c:1558
>#12 0x0001af11 in jsonRoomFlr () at roomops.c:3817
>#13 0x00008a41 in session_loop (HTTPHeaders=0x217b80, ReqLine=0x217b40,
>request_method=0x217b30, ReadBuf=0x25b5b0) at webcit.c:1005
>#14 0x00005c0a in context_loop (sock=0xb0284f58) at context_loop.c:566
>#15 0x000046b4 in worker_entry () at webserver.c:1055
>#16 0x94d8f095 in _pthread_start ()
>#17 0x94d8ef52 in thread_start ()
>(gdb) print TP->Filter
>$1 = {
>  ContextType = 15, 
>  ControlContextType = -1339551016, 
>  nMinArgs = 1229836, 
>  nMaxArgs = 2107232
>}
>
> This seems to me like a partly initialized Filter struct. I probably have
>to do s.th. with that in the various places where they're created; I'm
>thinking about a creator function. 
>
>just switch to roomlist in iconbar or request /json_roomflr to test.  
>
>--
>
>re cond..displaymsg, if I stick num_displayed,  maxmsgs and startmsg into my
>own struct, we'll get them as TP->Context and IterateStruct as
>TP->ControlContext, right?
>
>  



Right now its sort of like that:

the Intend of Controlcontext is to transport information from
"controlelements" like ITERATE/DOBOXED etc. into subtemplates of them, so you
can cheaply do stuff like ITERATE:N in a subtemplate fired by an iterator.

Context is the application one; its intend is to transport items from the
application layer down into tmlputs.

since we're talking about an ITERATOR situation here, this is used by the
payload taken from the list you're iterating over, right?

but, you've got to transport s.th. into an iterator, and additionaly control
the iterator with this, correct?

The primary thing controlling the behaviour of the iterator should be and
remain the template. So, my prefered way of doing this is to add optional
parameters to the iterator control element. 

The other way would probably be to do this inside of the function which gives
the iterator its list, so we would alter the signature of these functions.

There are several goals i've tried to accomplish with the templates:

 * de-couple c-code and content

 * get a descent performance out of it by:

    * if doing things in loops, make it as simple as possible 

    * don't loose information, we could use for later processing.
(stringlength, values you've put into the subst...)

    * handle stringbuffers in a smart way.

Reply via email to